@medialane/sdk 0.63.0 → 0.64.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,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { keccak_256 } from '@noble/hashes/sha3.js';
3
3
  import { base58, base32 } from '@scure/base';
4
- import { hash, num, cairo, Contract, uint256, RpcProvider, CairoOption, CairoOptionVariant, ec, encode, TypedDataRevision, constants, shortString } from 'starknet';
4
+ import { hash, Contract, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, encode, TypedDataRevision, constants, shortString } from 'starknet';
5
5
 
6
6
  // src/config.ts
7
7
 
@@ -1294,124 +1294,6 @@ function createFailoverFetch(urls, options = {}) {
1294
1294
  };
1295
1295
  return failover;
1296
1296
  }
1297
- var STARKNET_DOMAIN = [
1298
- { name: "name", type: "shortstring" },
1299
- { name: "version", type: "shortstring" },
1300
- { name: "chainId", type: "shortstring" },
1301
- { name: "revision", type: "shortstring" }
1302
- ];
1303
- var OFFER_ITEM = [
1304
- { name: "item_type", type: "shortstring" },
1305
- { name: "token", type: "ContractAddress" },
1306
- { name: "identifier_or_criteria", type: "felt" },
1307
- { name: "amount", type: "felt" }
1308
- ];
1309
- var CONSIDERATION_ITEM = [
1310
- { name: "item_type", type: "shortstring" },
1311
- { name: "token", type: "ContractAddress" },
1312
- { name: "identifier_or_criteria", type: "felt" },
1313
- { name: "amount", type: "felt" },
1314
- { name: "recipient", type: "ContractAddress" }
1315
- ];
1316
- var ORDER_PARAMETERS = [
1317
- { name: "offerer", type: "ContractAddress" },
1318
- { name: "marketplace", type: "ContractAddress" },
1319
- { name: "offer", type: "OfferItem" },
1320
- { name: "consideration", type: "ConsiderationItem" },
1321
- { name: "royalty_max_bps", type: "felt" },
1322
- { name: "start_time", type: "felt" },
1323
- { name: "end_time", type: "felt" },
1324
- { name: "salt", type: "felt" },
1325
- { name: "counter", type: "felt" }
1326
- ];
1327
- var ORDER_CANCELLATION = [
1328
- { name: "order_hash", type: "felt" },
1329
- { name: "offerer", type: "ContractAddress" }
1330
- ];
1331
- var DOMAIN_VERSION = {
1332
- erc721: "5",
1333
- erc1155: "4"
1334
- };
1335
- function buildDomain(standard, chainId) {
1336
- return {
1337
- name: "Medialane",
1338
- version: DOMAIN_VERSION[standard],
1339
- chainId,
1340
- revision: TypedDataRevision.ACTIVE
1341
- };
1342
- }
1343
- function buildOrderTypedData(message, chainId) {
1344
- return {
1345
- domain: buildDomain("erc721", chainId),
1346
- primaryType: "OrderParameters",
1347
- types: {
1348
- StarknetDomain: STARKNET_DOMAIN,
1349
- OrderParameters: ORDER_PARAMETERS,
1350
- OfferItem: OFFER_ITEM,
1351
- ConsiderationItem: CONSIDERATION_ITEM
1352
- },
1353
- message
1354
- };
1355
- }
1356
- function build1155OrderTypedData(message, chainId) {
1357
- return {
1358
- domain: buildDomain("erc1155", chainId),
1359
- primaryType: "OrderParameters",
1360
- types: {
1361
- StarknetDomain: STARKNET_DOMAIN,
1362
- OrderParameters: ORDER_PARAMETERS,
1363
- OfferItem: OFFER_ITEM,
1364
- ConsiderationItem: CONSIDERATION_ITEM
1365
- },
1366
- message
1367
- };
1368
- }
1369
- function buildCancellationTypedData(message, chainId) {
1370
- return {
1371
- domain: buildDomain("erc721", chainId),
1372
- primaryType: "OrderCancellation",
1373
- types: {
1374
- StarknetDomain: STARKNET_DOMAIN,
1375
- OrderCancellation: ORDER_CANCELLATION
1376
- },
1377
- message
1378
- };
1379
- }
1380
- function build1155CancellationTypedData(message, chainId) {
1381
- return {
1382
- domain: buildDomain("erc1155", chainId),
1383
- primaryType: "OrderCancellation",
1384
- types: {
1385
- StarknetDomain: STARKNET_DOMAIN,
1386
- OrderCancellation: ORDER_CANCELLATION
1387
- },
1388
- message
1389
- };
1390
- }
1391
- function encodeByteArray(str) {
1392
- const bytes = new TextEncoder().encode(str);
1393
- const fullChunks = [];
1394
- let i = 0;
1395
- while (i + 31 <= bytes.length) {
1396
- let val = 0n;
1397
- for (const b of bytes.slice(i, i + 31)) {
1398
- val = val << 8n | BigInt(b);
1399
- }
1400
- fullChunks.push(num.toHex(val));
1401
- i += 31;
1402
- }
1403
- const remaining = bytes.slice(i);
1404
- let pendingVal = 0n;
1405
- for (const b of remaining) {
1406
- pendingVal = pendingVal << 8n | BigInt(b);
1407
- }
1408
- return [
1409
- fullChunks.length.toString(),
1410
- ...fullChunks,
1411
- num.toHex(pendingVal),
1412
- remaining.length.toString()
1413
- ];
1414
- }
1415
1297
 
1416
1298
  // src/starknet/abis/ipMarketplace.ts
1417
1299
  var IPMarketplaceABI = [
@@ -11442,13 +11324,71 @@ var IPGenesisABI = [
11442
11324
  }
11443
11325
  ];
11444
11326
 
11445
- // src/starknet/marketplace/errors.ts
11446
- var MedialaneError = class extends Error {
11447
- constructor(message, code = "UNKNOWN", cause) {
11448
- super(message);
11449
- this.code = code;
11450
- this.cause = cause;
11451
- this.name = "MedialaneError";
11327
+ // src/starknet/services/pop.ts
11328
+ var PopService = class {
11329
+ constructor(config) {
11330
+ this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
11331
+ }
11332
+ _collection(address, account) {
11333
+ return new Contract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
11334
+ }
11335
+ async claim(account, collectionAddress) {
11336
+ const call = this._collection(collectionAddress, account).populate("claim", []);
11337
+ const res = await account.execute([call]);
11338
+ return { txHash: res.transaction_hash };
11339
+ }
11340
+ async adminMint(account, params) {
11341
+ const call = this._collection(params.collection, account).populate("admin_mint", [
11342
+ params.recipient,
11343
+ params.customUri ?? ""
11344
+ ]);
11345
+ const res = await account.execute([call]);
11346
+ return { txHash: res.transaction_hash };
11347
+ }
11348
+ async addToAllowlist(account, params) {
11349
+ const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
11350
+ const res = await account.execute([call]);
11351
+ return { txHash: res.transaction_hash };
11352
+ }
11353
+ async batchAddToAllowlist(account, params) {
11354
+ const collection = this._collection(params.collection, account);
11355
+ const CHUNK = 200;
11356
+ const calls = [];
11357
+ for (let i = 0; i < params.addresses.length; i += CHUNK) {
11358
+ calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
11359
+ }
11360
+ const res = await account.execute(calls);
11361
+ return { txHash: res.transaction_hash };
11362
+ }
11363
+ async removeFromAllowlist(account, params) {
11364
+ const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
11365
+ const res = await account.execute([call]);
11366
+ return { txHash: res.transaction_hash };
11367
+ }
11368
+ async setTokenUri(account, params) {
11369
+ const call = this._collection(params.collection, account).populate("set_token_uri", [
11370
+ BigInt(params.tokenId),
11371
+ params.uri
11372
+ ]);
11373
+ const res = await account.execute([call]);
11374
+ return { txHash: res.transaction_hash };
11375
+ }
11376
+ async setPaused(account, params) {
11377
+ const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
11378
+ const res = await account.execute([call]);
11379
+ return { txHash: res.transaction_hash };
11380
+ }
11381
+ async createCollection(account, params) {
11382
+ const factory = new Contract(POPFactoryABI, this.factoryAddress, account);
11383
+ const call = factory.populate("create_collection", [
11384
+ params.name,
11385
+ params.symbol,
11386
+ params.baseUri,
11387
+ params.claimEndTime,
11388
+ { [params.eventType]: {} }
11389
+ ]);
11390
+ const res = await account.execute([call]);
11391
+ return { txHash: res.transaction_hash };
11452
11392
  }
11453
11393
  };
11454
11394
  function buildFeeCall(p, cfg) {
@@ -11464,893 +11404,39 @@ function buildFeeCall(p, cfg) {
11464
11404
  calldata: [cfg.fundAddress, u.low.toString(), u.high.toString()]
11465
11405
  };
11466
11406
  }
11467
- var START_TIME_BUFFER_SECS = 30;
11468
- function generateSalt() {
11469
- const bytes = new Uint8Array(31);
11470
- crypto.getRandomValues(bytes);
11471
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
11472
- return num.toHex(BigInt("0x" + hex));
11407
+
11408
+ // src/starknet/services/drop.ts
11409
+ function toContractConditions(c) {
11410
+ return {
11411
+ start_time: c.startTime,
11412
+ end_time: c.endTime,
11413
+ price: BigInt(c.price),
11414
+ payment_token: c.paymentToken,
11415
+ max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
11416
+ };
11473
11417
  }
11474
- async function resolveRoyaltyMaxBps(provider, nft, tokenId, override) {
11475
- if (override !== void 0) return override;
11476
- try {
11477
- const id = cairo.uint256(tokenId);
11478
- const res = await provider.callContract({
11479
- contractAddress: nft,
11480
- entrypoint: "royalty_info",
11481
- calldata: [id.low.toString(), id.high.toString(), "10000", "0"]
11482
- });
11483
- return BigInt(res[1] ?? "0").toString();
11484
- } catch {
11485
- return "0";
11418
+ var DropService = class {
11419
+ constructor(config) {
11420
+ this.factoryAddress = getStarknetCoordinates(config.chain).dropFactory;
11421
+ this.config = config;
11486
11422
  }
11487
- }
11488
- function toSignatureArray(sig) {
11489
- if (Array.isArray(sig)) return sig;
11490
- const s = sig;
11491
- return [s.r.toString(), s.s.toString()];
11492
- }
11493
- function newContract(abi, address, providerOrAccount) {
11494
- const C = Contract;
11495
- return C.length === 1 ? new Contract({ abi, address, providerOrAccount }) : new Contract(
11496
- abi,
11497
- address,
11498
- providerOrAccount
11499
- );
11500
- }
11501
- function getChainId(config) {
11502
- if (config.chain !== "STARKNET") {
11503
- throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
11423
+ _collection(address, account) {
11424
+ return new Contract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
11504
11425
  }
11505
- return constants.StarknetChainId.SN_MAIN;
11506
- }
11507
- function resolveToken(currency) {
11508
- const token = SUPPORTED_TOKENS.find(
11509
- (t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
11510
- );
11511
- if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
11512
- return token;
11513
- }
11514
- var _providerCache = /* @__PURE__ */ new WeakMap();
11515
- function getProvider(config) {
11516
- let p = _providerCache.get(config);
11517
- if (!p) {
11518
- const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
11519
- p = new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
11520
- _providerCache.set(config, p);
11521
- }
11522
- return p;
11523
- }
11524
-
11525
- // src/starknet/marketplace/build.ts
11526
- function contractFor(cfg) {
11527
- return newContract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
11528
- }
11529
- function buildListingOrder(i, cfg) {
11530
- const orderParams = {
11531
- offerer: i.offerer,
11532
- marketplace: cfg.marketplaceContract,
11533
- offer: { item_type: "ERC721", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: "1" },
11534
- consideration: {
11535
- item_type: "ERC20",
11536
- token: i.paymentTokenAddress,
11537
- identifier_or_criteria: "0",
11538
- amount: i.priceWei,
11539
- recipient: i.offerer
11540
- },
11541
- royalty_max_bps: i.royaltyMaxBps,
11542
- start_time: String(i.startTime),
11543
- end_time: String(i.endTime),
11544
- salt: i.salt,
11545
- counter: i.counter
11546
- };
11547
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
11548
- return { orderParams, typedData };
11549
- }
11550
- function buildOfferOrder(i, cfg) {
11551
- const orderParams = {
11552
- offerer: i.offerer,
11553
- marketplace: cfg.marketplaceContract,
11554
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWei },
11555
- consideration: {
11556
- item_type: "ERC721",
11557
- token: i.nftContract,
11558
- identifier_or_criteria: i.tokenId,
11559
- amount: "1",
11560
- recipient: i.offerer
11561
- },
11562
- royalty_max_bps: i.royaltyMaxBps,
11563
- start_time: String(i.startTime),
11564
- end_time: String(i.endTime),
11565
- salt: i.salt,
11566
- counter: i.counter
11567
- };
11568
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
11569
- return { orderParams, typedData };
11570
- }
11571
- function registerPayload(orderParams, signature) {
11572
- return stringifyBigInts({
11573
- parameters: {
11574
- ...orderParams,
11575
- offer: { ...orderParams.offer, item_type: shortString.encodeShortString(orderParams.offer.item_type) },
11576
- consideration: {
11577
- ...orderParams.consideration,
11578
- item_type: shortString.encodeShortString(orderParams.consideration.item_type)
11579
- }
11580
- },
11581
- signature
11582
- });
11583
- }
11584
- function buildRegisterCalls(a, cfg) {
11585
- const registerCall = contractFor(cfg).populate("register_order", [registerPayload(a.orderParams, a.signature)]);
11586
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
11587
- }
11588
- function buildFulfillCalls(a, cfg) {
11589
- const u = cairo.uint256(a.totalPrice);
11590
- const approve = {
11591
- contractAddress: a.paymentToken,
11592
- entrypoint: "approve",
11593
- calldata: [cfg.marketplaceContract, u.low.toString(), u.high.toString()]
11594
- };
11595
- const fulfill = contractFor(cfg).populate("fulfill_order", [a.orderHash]);
11596
- const fee = buildFeeCall(
11597
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
11598
- cfg.feeConfig
11599
- );
11600
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
11601
- }
11602
- function buildCancelCalls(a, cfg) {
11603
- const cancelRequest = stringifyBigInts({
11604
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
11605
- signature: a.signature
11606
- });
11607
- return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
11608
- }
11609
- function buildCancelTypedData(orderHash, offerer, cfg) {
11610
- return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
11611
- }
11612
-
11613
- // src/starknet/marketplace/orders.ts
11614
- var _contractCache = /* @__PURE__ */ new WeakMap();
11615
- function makeContract(config) {
11616
- const cached = _contractCache.get(config);
11617
- const provider = getProvider(config);
11618
- if (cached) return { ...cached, provider };
11619
- const contract = newContract(IPMarketplaceABI, config.marketplaceContract, provider);
11620
- _contractCache.set(config, { contract });
11621
- return { contract, provider };
11622
- }
11623
- async function createListing(account, params, config) {
11624
- const { nftContract, tokenId, price, currency = DEFAULT_CURRENCY, durationSeconds } = params;
11625
- const { contract, provider } = makeContract(config);
11626
- const token = resolveToken(currency);
11627
- const priceWei = parseAmount(price, token.decimals);
11628
- const now = Math.floor(Date.now() / 1e3);
11629
- const startTime = now + START_TIME_BUFFER_SECS;
11630
- const endTime = now + durationSeconds;
11631
- const counter = (await contract.get_counter(account.address)).toString();
11632
- const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11633
- const { orderParams, typedData } = buildListingOrder(
11634
- {
11635
- offerer: account.address,
11636
- nftContract,
11637
- tokenId,
11638
- priceWei,
11639
- paymentTokenAddress: token.address,
11640
- royaltyMaxBps,
11641
- startTime,
11642
- endTime,
11643
- salt: generateSalt(),
11644
- counter
11645
- },
11646
- config
11647
- );
11648
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11649
- const tokenIdUint256 = cairo.uint256(tokenId);
11650
- let isAlreadyApproved = false;
11651
- try {
11652
- const result = await provider.callContract({
11653
- contractAddress: nftContract,
11654
- entrypoint: "get_approved",
11655
- calldata: [tokenIdUint256.low.toString(), tokenIdUint256.high.toString()]
11656
- });
11657
- isAlreadyApproved = BigInt(result[0]).toString() === BigInt(config.marketplaceContract).toString();
11658
- } catch {
11659
- }
11660
- const approve = {
11661
- contractAddress: nftContract,
11662
- entrypoint: "approve",
11663
- calldata: [
11664
- config.marketplaceContract,
11665
- tokenIdUint256.low.toString(),
11666
- tokenIdUint256.high.toString()
11667
- ]
11668
- };
11669
- const calls = buildRegisterCalls(
11670
- { orderParams, signature: signatureArray, approvalNeeded: !isAlreadyApproved, approve },
11671
- config
11672
- );
11673
- try {
11674
- const tx = await account.execute(calls);
11675
- await provider.waitForTransaction(tx.transaction_hash);
11676
- return { txHash: tx.transaction_hash };
11677
- } catch (err) {
11678
- throw new MedialaneError("Failed to create listing", "TRANSACTION_FAILED", err);
11679
- }
11680
- }
11681
- async function makeOffer(account, params, config) {
11682
- const { nftContract, tokenId, price, currency = DEFAULT_CURRENCY, durationSeconds } = params;
11683
- const { contract, provider } = makeContract(config);
11684
- const token = resolveToken(currency);
11685
- const priceWei = parseAmount(price, token.decimals);
11686
- const now = Math.floor(Date.now() / 1e3);
11687
- const startTime = now + START_TIME_BUFFER_SECS;
11688
- const endTime = now + durationSeconds;
11689
- const counter = (await contract.get_counter(account.address)).toString();
11690
- const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11691
- const { orderParams, typedData } = buildOfferOrder(
11692
- {
11693
- offerer: account.address,
11694
- nftContract,
11695
- tokenId,
11696
- priceWei,
11697
- paymentTokenAddress: token.address,
11698
- royaltyMaxBps,
11699
- startTime,
11700
- endTime,
11701
- salt: generateSalt(),
11702
- counter
11703
- },
11704
- config
11705
- );
11706
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11707
- const amountUint256 = cairo.uint256(priceWei);
11708
- const approveCall = {
11709
- contractAddress: token.address,
11710
- entrypoint: "approve",
11711
- calldata: [
11712
- config.marketplaceContract,
11713
- amountUint256.low.toString(),
11714
- amountUint256.high.toString()
11715
- ]
11716
- };
11717
- const calls = buildRegisterCalls(
11718
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
11719
- config
11720
- );
11721
- try {
11722
- const tx = await account.execute(calls);
11723
- await provider.waitForTransaction(tx.transaction_hash);
11724
- return { txHash: tx.transaction_hash };
11725
- } catch (err) {
11726
- throw new MedialaneError("Failed to make offer", "TRANSACTION_FAILED", err);
11727
- }
11728
- }
11729
- async function fulfillOrder(account, params, config) {
11730
- const { orderHash, paymentToken, totalPrice } = params;
11731
- const { provider } = makeContract(config);
11732
- const calls = buildFulfillCalls({ orderHash, paymentToken, totalPrice }, config);
11733
- try {
11734
- const tx = await account.execute(calls);
11735
- await provider.waitForTransaction(tx.transaction_hash);
11736
- return { txHash: tx.transaction_hash };
11737
- } catch (err) {
11738
- throw new MedialaneError("Failed to fulfill order", "TRANSACTION_FAILED", err);
11739
- }
11740
- }
11741
- async function cancelOrder(account, params, config) {
11742
- const { orderHash } = params;
11743
- const { provider } = makeContract(config);
11744
- const typedData = buildCancelTypedData(orderHash, account.address, config);
11745
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11746
- const calls = buildCancelCalls({ orderHash, offerer: account.address, signature: signatureArray }, config);
11747
- try {
11748
- const tx = await account.execute(calls);
11749
- await provider.waitForTransaction(tx.transaction_hash);
11750
- return { txHash: tx.transaction_hash };
11751
- } catch (err) {
11752
- throw new MedialaneError("Failed to cancel order", "TRANSACTION_FAILED", err);
11753
- }
11754
- }
11755
- async function mint(account, params, config) {
11756
- const { collectionId, recipient, tokenUri, royaltyBps, collectionContract } = params;
11757
- const provider = getProvider(config);
11758
- const contractAddress = collectionContract ?? config.collectionContract;
11759
- const id = cairo.uint256(collectionId);
11760
- const calldata = [
11761
- id.low.toString(),
11762
- id.high.toString(),
11763
- recipient,
11764
- ...encodeByteArray(tokenUri),
11765
- royaltyBps.toString()
11766
- ];
11767
- try {
11768
- const tx = await account.execute([{ contractAddress, entrypoint: "mint", calldata }]);
11769
- await provider.waitForTransaction(tx.transaction_hash);
11770
- return { txHash: tx.transaction_hash };
11771
- } catch (err) {
11772
- throw new MedialaneError("Failed to mint NFT", "TRANSACTION_FAILED", err);
11773
- }
11774
- }
11775
- async function createCollection(account, params, config) {
11776
- const { name, symbol, baseUri, collectionContract } = params;
11777
- const provider = getProvider(config);
11778
- const contractAddress = collectionContract ?? config.collectionContract;
11779
- const calldata = [
11780
- ...encodeByteArray(name),
11781
- ...encodeByteArray(symbol),
11782
- ...encodeByteArray(baseUri)
11783
- ];
11784
- try {
11785
- const tx = await account.execute([{ contractAddress, entrypoint: "create_collection", calldata }]);
11786
- await provider.waitForTransaction(tx.transaction_hash);
11787
- return { txHash: tx.transaction_hash };
11788
- } catch (err) {
11789
- throw new MedialaneError("Failed to create collection", "TRANSACTION_FAILED", err);
11790
- }
11791
- }
11792
- async function checkoutCart(account, items, config) {
11793
- if (items.length === 0) throw new MedialaneError("Cart is empty", "INVALID_PARAMS");
11794
- const { contract, provider } = makeContract(config);
11795
- const tokenTotals = /* @__PURE__ */ new Map();
11796
- for (const item of items) {
11797
- const prev = tokenTotals.get(item.considerationToken) ?? 0n;
11798
- tokenTotals.set(item.considerationToken, prev + BigInt(item.considerationAmount));
11799
- }
11800
- const approveCalls = Array.from(tokenTotals.entries()).map(([tokenAddr, totalWei]) => {
11801
- const amount = cairo.uint256(totalWei.toString());
11802
- return {
11803
- contractAddress: tokenAddr,
11804
- entrypoint: "approve",
11805
- calldata: [
11806
- config.marketplaceContract,
11807
- amount.low.toString(),
11808
- amount.high.toString()
11809
- ]
11810
- };
11811
- });
11812
- const fulfillCalls = items.map(
11813
- (item) => contract.populate("fulfill_order", [item.orderHash])
11814
- );
11815
- const feeCalls = Array.from(tokenTotals.entries()).map(
11816
- ([tokenAddr, totalWei]) => buildFeeCall(
11817
- { surface: "marketplace", token: tokenAddr, grossAmount: totalWei },
11818
- config.feeConfig
11819
- )
11820
- ).filter((c) => c !== null);
11821
- try {
11822
- const tx = await account.execute([...approveCalls, ...fulfillCalls, ...feeCalls]);
11823
- await provider.waitForTransaction(tx.transaction_hash);
11824
- return { txHash: tx.transaction_hash };
11825
- } catch (err) {
11826
- throw new MedialaneError("Cart checkout failed", "TRANSACTION_FAILED", err);
11827
- }
11828
- }
11829
- async function getOrderDetails(orderHash, config) {
11830
- const { contract } = makeContract(config);
11831
- return contract.get_order_details(orderHash);
11832
- }
11833
- async function getCounter(address, config) {
11834
- const { contract } = makeContract(config);
11835
- return BigInt((await contract.get_counter(address)).toString());
11836
- }
11837
- async function incrementCounter(account, config) {
11838
- const { contract, provider } = makeContract(config);
11839
- const call = contract.populate("increment_counter", []);
11840
- try {
11841
- const tx = await account.execute(call);
11842
- await provider.waitForTransaction(tx.transaction_hash);
11843
- return { txHash: tx.transaction_hash };
11844
- } catch (err) {
11845
- throw new MedialaneError("Failed to increment counter", "TRANSACTION_FAILED", err);
11846
- }
11847
- }
11848
-
11849
- // src/starknet/marketplace/index.ts
11850
- var MarketplaceModule = class {
11851
- constructor(config) {
11852
- this.config = config;
11853
- }
11854
- // ─── Writes ───────────────────────────────────────────────────────────────
11855
- createListing(account, params) {
11856
- return createListing(account, params, this.config);
11857
- }
11858
- makeOffer(account, params) {
11859
- return makeOffer(account, params, this.config);
11860
- }
11861
- fulfillOrder(account, params) {
11862
- return fulfillOrder(account, params, this.config);
11863
- }
11864
- cancelOrder(account, params) {
11865
- return cancelOrder(account, params, this.config);
11866
- }
11867
- checkoutCart(account, items) {
11868
- return checkoutCart(account, items, this.config);
11869
- }
11870
- mint(account, params) {
11871
- return mint(account, params, this.config);
11872
- }
11873
- createCollection(account, params) {
11874
- return createCollection(account, params, this.config);
11875
- }
11876
- /** Bulk-cancel: bump the caller's counter, invalidating all their open orders. */
11877
- incrementCounter(account) {
11878
- return incrementCounter(account, this.config);
11879
- }
11880
- // ─── View calls ───────────────────────────────────────────────────────────
11881
- getOrderDetails(orderHash) {
11882
- return getOrderDetails(orderHash, this.config);
11883
- }
11884
- getCounter(address) {
11885
- return getCounter(address, this.config);
11886
- }
11887
- // ─── Typed data builders (for ChipiPay / custom signing flows) ───────────
11888
- buildListingTypedData(params, chainId) {
11889
- return buildOrderTypedData(params, chainId);
11890
- }
11891
- buildCancellationTypedData(params, chainId) {
11892
- return buildCancellationTypedData(params, chainId);
11893
- }
11894
- };
11895
- function contractFor2(cfg) {
11896
- return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
11897
- }
11898
- function buildListing1155Order(i, cfg) {
11899
- const orderParams = {
11900
- offerer: i.offerer,
11901
- marketplace: cfg.marketplace1155Contract,
11902
- offer: { item_type: "ERC1155", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: i.quantity },
11903
- consideration: {
11904
- item_type: "ERC20",
11905
- token: i.paymentTokenAddress,
11906
- identifier_or_criteria: "0",
11907
- amount: i.priceWeiPerUnit,
11908
- recipient: i.offerer
11909
- },
11910
- royalty_max_bps: i.royaltyMaxBps,
11911
- start_time: String(i.startTime),
11912
- end_time: String(i.endTime),
11913
- salt: i.salt,
11914
- counter: i.counter
11915
- };
11916
- const typedData = stringifyBigInts(
11917
- build1155OrderTypedData(orderParams, getChainId(cfg))
11918
- );
11919
- return { orderParams, typedData };
11920
- }
11921
- function buildOffer1155Order(i, cfg) {
11922
- const orderParams = {
11923
- offerer: i.offerer,
11924
- marketplace: cfg.marketplace1155Contract,
11925
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWeiPerUnit },
11926
- consideration: {
11927
- item_type: "ERC1155",
11928
- token: i.nftContract,
11929
- identifier_or_criteria: i.tokenId,
11930
- amount: i.quantity,
11931
- recipient: i.offerer
11932
- },
11933
- royalty_max_bps: i.royaltyMaxBps,
11934
- start_time: String(i.startTime),
11935
- end_time: String(i.endTime),
11936
- salt: i.salt,
11937
- counter: i.counter
11938
- };
11939
- const typedData = stringifyBigInts(
11940
- build1155OrderTypedData(orderParams, getChainId(cfg))
11941
- );
11942
- return { orderParams, typedData };
11943
- }
11944
- function registerPayload2(orderParams, signature) {
11945
- return stringifyBigInts({
11946
- parameters: {
11947
- ...orderParams,
11948
- offer: { ...orderParams.offer, item_type: shortString.encodeShortString(orderParams.offer.item_type) },
11949
- consideration: {
11950
- ...orderParams.consideration,
11951
- item_type: shortString.encodeShortString(orderParams.consideration.item_type)
11952
- }
11953
- },
11954
- signature
11955
- });
11956
- }
11957
- function buildRegister1155Calls(a, cfg) {
11958
- const registerCall = contractFor2(cfg).populate("register_order", [registerPayload2(a.orderParams, a.signature)]);
11959
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
11960
- }
11961
- function buildFulfill1155Calls(a, cfg) {
11962
- const u = cairo.uint256(a.totalPrice);
11963
- const approve = {
11964
- contractAddress: a.paymentToken,
11965
- entrypoint: "approve",
11966
- calldata: [cfg.marketplace1155Contract, u.low.toString(), u.high.toString()]
11967
- };
11968
- const fulfill = contractFor2(cfg).populate("fulfill_order", [a.orderHash, a.quantity]);
11969
- const fee = buildFeeCall(
11970
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
11971
- cfg.feeConfig
11972
- );
11973
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
11974
- }
11975
- function buildCancel1155Calls(a, cfg) {
11976
- const cancelPayload = stringifyBigInts({
11977
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
11978
- signature: a.signature
11979
- });
11980
- return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
11981
- }
11982
- function buildCancel1155TypedData(orderHash, offerer, cfg) {
11983
- return stringifyBigInts(
11984
- build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
11985
- );
11986
- }
11987
-
11988
- // src/starknet/marketplace1155/orders.ts
11989
- var _contractCache2 = /* @__PURE__ */ new WeakMap();
11990
- function getContract(config) {
11991
- let c = _contractCache2.get(config);
11992
- if (!c) {
11993
- const provider = getProvider(config);
11994
- c = newContract(Medialane1155ABI, config.marketplace1155Contract, provider);
11995
- _contractCache2.set(config, c);
11996
- }
11997
- return c;
11998
- }
11999
- async function createListing1155(account, params, config) {
12000
- const {
12001
- nftContract,
12002
- tokenId,
12003
- amount,
12004
- pricePerUnit,
12005
- currency = DEFAULT_CURRENCY,
12006
- durationSeconds
12007
- } = params;
12008
- const contract = getContract(config);
12009
- const provider = getProvider(config);
12010
- const token = resolveToken(currency);
12011
- const priceWei = parseAmount(pricePerUnit, token.decimals);
12012
- const now = Math.floor(Date.now() / 1e3);
12013
- const startTime = now + START_TIME_BUFFER_SECS;
12014
- const endTime = now + durationSeconds;
12015
- const counter = (await contract.get_counter(account.address)).toString();
12016
- const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
12017
- const { orderParams, typedData } = buildListing1155Order(
12018
- {
12019
- offerer: account.address,
12020
- nftContract,
12021
- tokenId,
12022
- quantity: amount,
12023
- priceWeiPerUnit: priceWei,
12024
- paymentTokenAddress: token.address,
12025
- royaltyMaxBps,
12026
- startTime,
12027
- endTime,
12028
- salt: generateSalt(),
12029
- counter
12030
- },
12031
- config
12032
- );
12033
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
12034
- let isApproved = false;
12035
- try {
12036
- const result = await provider.callContract({
12037
- contractAddress: nftContract,
12038
- entrypoint: "is_approved_for_all",
12039
- calldata: [account.address, config.marketplace1155Contract]
12040
- });
12041
- isApproved = BigInt(result[0]) === 1n;
12042
- } catch {
12043
- }
12044
- const approve = {
12045
- contractAddress: nftContract,
12046
- entrypoint: "set_approval_for_all",
12047
- calldata: [config.marketplace1155Contract, "1"]
12048
- };
12049
- const calls = buildRegister1155Calls(
12050
- { orderParams, signature: signatureArray, approvalNeeded: !isApproved, approve },
12051
- config
12052
- );
12053
- try {
12054
- const tx = await account.execute(calls);
12055
- await provider.waitForTransaction(tx.transaction_hash);
12056
- return { txHash: tx.transaction_hash };
12057
- } catch (err) {
12058
- throw new MedialaneError("Failed to create ERC-1155 listing", "TRANSACTION_FAILED", err);
12059
- }
12060
- }
12061
- async function fulfillOrder1155(account, params, config) {
12062
- const { orderHash, paymentToken, totalPrice, quantity = "1" } = params;
12063
- const provider = getProvider(config);
12064
- const calls = buildFulfill1155Calls({ orderHash, paymentToken, totalPrice, quantity }, config);
12065
- try {
12066
- const tx = await account.execute(calls);
12067
- await provider.waitForTransaction(tx.transaction_hash);
12068
- return { txHash: tx.transaction_hash };
12069
- } catch (err) {
12070
- throw new MedialaneError("Failed to fulfill ERC-1155 order", "TRANSACTION_FAILED", err);
12071
- }
12072
- }
12073
- async function cancelOrder1155(account, params, config) {
12074
- const { orderHash } = params;
12075
- const provider = getProvider(config);
12076
- const typedData = buildCancel1155TypedData(orderHash, account.address, config);
12077
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
12078
- const calls = buildCancel1155Calls({ orderHash, offerer: account.address, signature: signatureArray }, config);
12079
- try {
12080
- const tx = await account.execute(calls);
12081
- await provider.waitForTransaction(tx.transaction_hash);
12082
- return { txHash: tx.transaction_hash };
12083
- } catch (err) {
12084
- throw new MedialaneError("Failed to cancel ERC-1155 order", "TRANSACTION_FAILED", err);
12085
- }
12086
- }
12087
- async function makeOffer1155(account, params, config) {
12088
- const {
12089
- nftContract,
12090
- tokenId,
12091
- amount,
12092
- price,
12093
- currency = DEFAULT_CURRENCY,
12094
- durationSeconds
12095
- } = params;
12096
- const contract = getContract(config);
12097
- const provider = getProvider(config);
12098
- const token = resolveToken(currency);
12099
- const priceWei = parseAmount(price, token.decimals);
12100
- const now = Math.floor(Date.now() / 1e3);
12101
- const startTime = now + START_TIME_BUFFER_SECS;
12102
- const endTime = now + durationSeconds;
12103
- const counter = (await contract.get_counter(account.address)).toString();
12104
- const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
12105
- const { orderParams, typedData } = buildOffer1155Order(
12106
- {
12107
- offerer: account.address,
12108
- nftContract,
12109
- tokenId,
12110
- quantity: amount,
12111
- priceWeiPerUnit: priceWei,
12112
- paymentTokenAddress: token.address,
12113
- royaltyMaxBps,
12114
- startTime,
12115
- endTime,
12116
- salt: generateSalt(),
12117
- counter
12118
- },
12119
- config
12120
- );
12121
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
12122
- const totalWei = BigInt(priceWei) * BigInt(amount);
12123
- const amountU256 = cairo.uint256(totalWei.toString());
12124
- const approveCall = {
12125
- contractAddress: token.address,
12126
- entrypoint: "approve",
12127
- calldata: [
12128
- config.marketplace1155Contract,
12129
- amountU256.low.toString(),
12130
- amountU256.high.toString()
12131
- ]
12132
- };
12133
- const calls = buildRegister1155Calls(
12134
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
12135
- config
12136
- );
12137
- try {
12138
- const tx = await account.execute(calls);
12139
- await provider.waitForTransaction(tx.transaction_hash);
12140
- return { txHash: tx.transaction_hash };
12141
- } catch (err) {
12142
- throw new MedialaneError("Failed to make ERC-1155 offer", "TRANSACTION_FAILED", err);
12143
- }
12144
- }
12145
- async function checkoutCart1155(account, items, config) {
12146
- if (items.length === 0) throw new MedialaneError("Cart is empty", "INVALID_PARAMS");
12147
- const contract = getContract(config);
12148
- const provider = getProvider(config);
12149
- const tokenTotals = /* @__PURE__ */ new Map();
12150
- for (const item of items) {
12151
- const prev = tokenTotals.get(item.considerationToken) ?? 0n;
12152
- tokenTotals.set(item.considerationToken, prev + BigInt(item.considerationAmount));
12153
- }
12154
- const approveCalls = Array.from(tokenTotals.entries()).map(([tokenAddr, totalWei]) => {
12155
- const amount = cairo.uint256(totalWei.toString());
12156
- return {
12157
- contractAddress: tokenAddr,
12158
- entrypoint: "approve",
12159
- calldata: [
12160
- config.marketplace1155Contract,
12161
- amount.low.toString(),
12162
- amount.high.toString()
12163
- ]
12164
- };
12165
- });
12166
- const fulfillCalls = items.map(
12167
- (item) => contract.populate("fulfill_order", [item.orderHash, item.quantity ?? "1"])
12168
- );
12169
- try {
12170
- const tx = await account.execute([...approveCalls, ...fulfillCalls]);
12171
- await provider.waitForTransaction(tx.transaction_hash);
12172
- return { txHash: tx.transaction_hash };
12173
- } catch (err) {
12174
- throw new MedialaneError("ERC-1155 cart checkout failed", "TRANSACTION_FAILED", err);
12175
- }
12176
- }
12177
- async function getOrderDetails1155(orderHash, config) {
12178
- const contract = getContract(config);
12179
- return contract.get_order_details(orderHash);
12180
- }
12181
- async function getCounter1155(address, config) {
12182
- const contract = getContract(config);
12183
- return BigInt((await contract.get_counter(address)).toString());
12184
- }
12185
- async function incrementCounter1155(account, config) {
12186
- const contract = getContract(config);
12187
- const provider = getProvider(config);
12188
- const call = contract.populate("increment_counter", []);
12189
- try {
12190
- const tx = await account.execute(call);
12191
- await provider.waitForTransaction(tx.transaction_hash);
12192
- return { txHash: tx.transaction_hash };
12193
- } catch (err) {
12194
- throw new MedialaneError("Failed to increment counter (1155)", "TRANSACTION_FAILED", err);
12195
- }
12196
- }
12197
-
12198
- // src/starknet/marketplace1155/index.ts
12199
- var Medialane1155Module = class {
12200
- constructor(config) {
12201
- this.config = config;
12202
- }
12203
- // ─── Writes ───────────────────────────────────────────────────────────────
12204
- /**
12205
- * Create an ERC-1155 sell listing.
12206
- * Optionally grants `set_approval_for_all` if not already approved.
12207
- */
12208
- createListing(account, params) {
12209
- return createListing1155(account, params, this.config);
12210
- }
12211
- /**
12212
- * Make an offer (bid) on an ERC-1155 token.
12213
- * Approves the ERC-20 spend then calls `register_order` atomically.
12214
- */
12215
- makeOffer(account, params) {
12216
- return makeOffer1155(account, params, this.config);
12217
- }
12218
- /**
12219
- * Fulfill (buy) an ERC-1155 listing.
12220
- * Approves the payment token then calls `fulfill_order` atomically.
12221
- */
12222
- fulfillOrder(account, params) {
12223
- return fulfillOrder1155(account, params, this.config);
12224
- }
12225
- /**
12226
- * Cancel an ERC-1155 listing (offerer only).
12227
- */
12228
- cancelOrder(account, params) {
12229
- return cancelOrder1155(account, params, this.config);
12230
- }
12231
- /**
12232
- * Checkout a cart of ERC-1155 orders atomically.
12233
- * Signs one fulfillment per item (with quantity), sums ERC-20 approvals by token.
12234
- */
12235
- checkoutCart(account, items) {
12236
- return checkoutCart1155(account, items, this.config);
12237
- }
12238
- /** Bulk-cancel on the 1155 venue: bump the caller's counter. */
12239
- incrementCounter(account) {
12240
- return incrementCounter1155(account, this.config);
12241
- }
12242
- // ─── View calls ───────────────────────────────────────────────────────────
12243
- getOrderDetails(orderHash) {
12244
- return getOrderDetails1155(orderHash, this.config);
12245
- }
12246
- getCounter(address) {
12247
- return getCounter1155(address, this.config);
12248
- }
12249
- // ─── Typed data builders (for ChipiPay / custom signing flows) ───────────
12250
- buildListingTypedData(params, chainId) {
12251
- return build1155OrderTypedData(params, chainId);
12252
- }
12253
- buildCancellationTypedData(params, chainId) {
12254
- return build1155CancellationTypedData(params, chainId);
12255
- }
12256
- };
12257
- var PopService = class {
12258
- constructor(config) {
12259
- this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
12260
- }
12261
- _collection(address, account) {
12262
- return new Contract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
12263
- }
12264
- async claim(account, collectionAddress) {
12265
- const call = this._collection(collectionAddress, account).populate("claim", []);
12266
- const res = await account.execute([call]);
12267
- return { txHash: res.transaction_hash };
12268
- }
12269
- async adminMint(account, params) {
12270
- const call = this._collection(params.collection, account).populate("admin_mint", [
12271
- params.recipient,
12272
- params.customUri ?? ""
12273
- ]);
12274
- const res = await account.execute([call]);
12275
- return { txHash: res.transaction_hash };
12276
- }
12277
- async addToAllowlist(account, params) {
12278
- const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
12279
- const res = await account.execute([call]);
12280
- return { txHash: res.transaction_hash };
12281
- }
12282
- async batchAddToAllowlist(account, params) {
12283
- const collection = this._collection(params.collection, account);
12284
- const CHUNK = 200;
12285
- const calls = [];
12286
- for (let i = 0; i < params.addresses.length; i += CHUNK) {
12287
- calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
12288
- }
12289
- const res = await account.execute(calls);
12290
- return { txHash: res.transaction_hash };
12291
- }
12292
- async removeFromAllowlist(account, params) {
12293
- const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
12294
- const res = await account.execute([call]);
12295
- return { txHash: res.transaction_hash };
12296
- }
12297
- async setTokenUri(account, params) {
12298
- const call = this._collection(params.collection, account).populate("set_token_uri", [
12299
- BigInt(params.tokenId),
12300
- params.uri
12301
- ]);
12302
- const res = await account.execute([call]);
12303
- return { txHash: res.transaction_hash };
12304
- }
12305
- async setPaused(account, params) {
12306
- const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
12307
- const res = await account.execute([call]);
12308
- return { txHash: res.transaction_hash };
12309
- }
12310
- async createCollection(account, params) {
12311
- const factory = new Contract(POPFactoryABI, this.factoryAddress, account);
12312
- const call = factory.populate("create_collection", [
12313
- params.name,
12314
- params.symbol,
12315
- params.baseUri,
12316
- params.claimEndTime,
12317
- { [params.eventType]: {} }
12318
- ]);
12319
- const res = await account.execute([call]);
12320
- return { txHash: res.transaction_hash };
12321
- }
12322
- };
12323
- function toContractConditions(c) {
12324
- return {
12325
- start_time: c.startTime,
12326
- end_time: c.endTime,
12327
- price: BigInt(c.price),
12328
- payment_token: c.paymentToken,
12329
- max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
12330
- };
12331
- }
12332
- var DropService = class {
12333
- constructor(config) {
12334
- this.factoryAddress = getStarknetCoordinates(config.chain).dropFactory;
12335
- this.config = config;
12336
- }
12337
- _collection(address, account) {
12338
- return new Contract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
12339
- }
12340
- async claim(account, collectionAddress, quantity = 1) {
12341
- const collection = this._collection(collectionAddress, account);
12342
- const qty = BigInt(quantity);
12343
- const claimCall = collection.populate("claim", [qty]);
12344
- const conditions = await collection.get_claim_conditions();
12345
- const price = BigInt(conditions.price);
12346
- const paymentToken = typeof conditions.payment_token === "bigint" ? "0x" + conditions.payment_token.toString(16) : conditions.payment_token;
12347
- const feeCall = price > 0n ? buildFeeCall(
12348
- { surface: "launchpad", token: paymentToken, grossAmount: price * qty },
12349
- this.config.feeConfig
12350
- ) : null;
12351
- const calls = feeCall ? [claimCall, feeCall] : [claimCall];
12352
- const res = await account.execute(calls);
12353
- return { txHash: res.transaction_hash };
11426
+ async claim(account, collectionAddress, quantity = 1) {
11427
+ const collection = this._collection(collectionAddress, account);
11428
+ const qty = BigInt(quantity);
11429
+ const claimCall = collection.populate("claim", [qty]);
11430
+ const conditions = await collection.get_claim_conditions();
11431
+ const price = BigInt(conditions.price);
11432
+ const paymentToken = typeof conditions.payment_token === "bigint" ? "0x" + conditions.payment_token.toString(16) : conditions.payment_token;
11433
+ const feeCall = price > 0n ? buildFeeCall(
11434
+ { surface: "launchpad", token: paymentToken, grossAmount: price * qty },
11435
+ this.config.feeConfig
11436
+ ) : null;
11437
+ const calls = feeCall ? [claimCall, feeCall] : [claimCall];
11438
+ const res = await account.execute(calls);
11439
+ return { txHash: res.transaction_hash };
12354
11440
  }
12355
11441
  async adminMint(account, params) {
12356
11442
  const call = this._collection(params.collection, account).populate("admin_mint", [
@@ -12972,54 +12058,412 @@ var SponsorshipService = class {
12972
12058
  }
12973
12059
  };
12974
12060
 
12975
- // src/starknet/client.ts
12976
- var MedialaneClient = class {
12977
- constructor(rawConfig = {}) {
12978
- this.config = resolveConfig(rawConfig);
12979
- this.marketplace = new MarketplaceModule(this.config);
12980
- this.marketplace1155 = new Medialane1155Module(this.config);
12981
- this.services = {
12982
- pop: new PopService(this.config),
12983
- drop: new DropService(this.config),
12984
- erc1155Collection: new ERC1155CollectionService(this.config),
12985
- creatorCoin: new CreatorCoinService(this.config),
12986
- ticket: new TicketService(this.config),
12987
- club: new ClubService(this.config),
12988
- sponsorship: new SponsorshipService(this.config)
12989
- };
12990
- if (!this.config.backendUrl) {
12991
- const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
12992
- const apiMethodNames = new Set(
12993
- Object.getOwnPropertyNames(ApiClient.prototype).filter(
12994
- (k) => k !== "constructor" && typeof sentinel[k] === "function"
12995
- )
12996
- );
12997
- this.api = new Proxy(sentinel, {
12998
- get(target, prop, receiver) {
12999
- if (typeof prop === "symbol" || !apiMethodNames.has(prop)) {
13000
- return Reflect.get(target, prop, receiver);
13001
- }
13002
- return () => {
13003
- throw new Error(
13004
- `backendUrl not configured. Pass backendUrl to MedialaneClient to use .api.${String(prop)}()`
13005
- );
13006
- };
13007
- }
13008
- });
13009
- } else {
13010
- this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
13011
- }
13012
- }
13013
- get chain() {
13014
- return this.config.chain;
13015
- }
13016
- get rpcUrl() {
13017
- return this.config.rpcUrl;
13018
- }
13019
- get marketplaceContract() {
13020
- return this.config.marketplaceContract;
13021
- }
13022
- };
12061
+ // src/starknet/client.ts
12062
+ var MedialaneClient = class {
12063
+ constructor(rawConfig = {}) {
12064
+ this.config = resolveConfig(rawConfig);
12065
+ this.services = {
12066
+ pop: new PopService(this.config),
12067
+ drop: new DropService(this.config),
12068
+ erc1155Collection: new ERC1155CollectionService(this.config),
12069
+ creatorCoin: new CreatorCoinService(this.config),
12070
+ ticket: new TicketService(this.config),
12071
+ club: new ClubService(this.config),
12072
+ sponsorship: new SponsorshipService(this.config)
12073
+ };
12074
+ if (!this.config.backendUrl) {
12075
+ const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
12076
+ const apiMethodNames = new Set(
12077
+ Object.getOwnPropertyNames(ApiClient.prototype).filter(
12078
+ (k) => k !== "constructor" && typeof sentinel[k] === "function"
12079
+ )
12080
+ );
12081
+ this.api = new Proxy(sentinel, {
12082
+ get(target, prop, receiver) {
12083
+ if (typeof prop === "symbol" || !apiMethodNames.has(prop)) {
12084
+ return Reflect.get(target, prop, receiver);
12085
+ }
12086
+ return () => {
12087
+ throw new Error(
12088
+ `backendUrl not configured. Pass backendUrl to MedialaneClient to use .api.${String(prop)}()`
12089
+ );
12090
+ };
12091
+ }
12092
+ });
12093
+ } else {
12094
+ this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
12095
+ }
12096
+ }
12097
+ get chain() {
12098
+ return this.config.chain;
12099
+ }
12100
+ get rpcUrl() {
12101
+ return this.config.rpcUrl;
12102
+ }
12103
+ get marketplaceContract() {
12104
+ return this.config.marketplaceContract;
12105
+ }
12106
+ };
12107
+
12108
+ // src/starknet/marketplace/errors.ts
12109
+ var MedialaneError = class extends Error {
12110
+ constructor(message, code = "UNKNOWN", cause) {
12111
+ super(message);
12112
+ this.code = code;
12113
+ this.cause = cause;
12114
+ this.name = "MedialaneError";
12115
+ }
12116
+ };
12117
+ var START_TIME_BUFFER_SECS = 30;
12118
+ function newContract(abi, address, providerOrAccount) {
12119
+ const C = Contract;
12120
+ return C.length === 1 ? new Contract({ abi, address, providerOrAccount }) : new Contract(
12121
+ abi,
12122
+ address,
12123
+ providerOrAccount
12124
+ );
12125
+ }
12126
+ function getChainId(config) {
12127
+ if (config.chain !== "STARKNET") {
12128
+ throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
12129
+ }
12130
+ return constants.StarknetChainId.SN_MAIN;
12131
+ }
12132
+ function resolveToken(currency) {
12133
+ const token = SUPPORTED_TOKENS.find(
12134
+ (t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
12135
+ );
12136
+ if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
12137
+ return token;
12138
+ }
12139
+ var _providerCache = /* @__PURE__ */ new WeakMap();
12140
+ function getProvider(config) {
12141
+ let p = _providerCache.get(config);
12142
+ if (!p) {
12143
+ const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
12144
+ p = new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
12145
+ _providerCache.set(config, p);
12146
+ }
12147
+ return p;
12148
+ }
12149
+
12150
+ // src/starknet/marketplace/orders.ts
12151
+ var _contractCache = /* @__PURE__ */ new WeakMap();
12152
+ function makeContract(config) {
12153
+ const cached = _contractCache.get(config);
12154
+ if (cached) return cached;
12155
+ const contract = newContract(
12156
+ IPMarketplaceABI,
12157
+ config.marketplaceContract,
12158
+ getProvider(config)
12159
+ );
12160
+ const entry = { contract };
12161
+ _contractCache.set(config, entry);
12162
+ return entry;
12163
+ }
12164
+ async function getOrderDetails(orderHash, config) {
12165
+ const { contract } = makeContract(config);
12166
+ return contract.get_order_details(orderHash);
12167
+ }
12168
+ async function getCounter(address, config) {
12169
+ const { contract } = makeContract(config);
12170
+ return BigInt((await contract.get_counter(address)).toString());
12171
+ }
12172
+
12173
+ // src/starknet/marketplace1155/orders.ts
12174
+ var _contractCache2 = /* @__PURE__ */ new WeakMap();
12175
+ function getContract(config) {
12176
+ let c = _contractCache2.get(config);
12177
+ if (!c) {
12178
+ c = newContract(Medialane1155ABI, config.marketplace1155Contract, getProvider(config));
12179
+ _contractCache2.set(config, c);
12180
+ }
12181
+ return c;
12182
+ }
12183
+ async function getOrderDetails1155(orderHash, config) {
12184
+ const contract = getContract(config);
12185
+ return contract.get_order_details(orderHash);
12186
+ }
12187
+ async function getCounter1155(address, config) {
12188
+ const contract = getContract(config);
12189
+ return BigInt((await contract.get_counter(address)).toString());
12190
+ }
12191
+ var STARKNET_DOMAIN = [
12192
+ { name: "name", type: "shortstring" },
12193
+ { name: "version", type: "shortstring" },
12194
+ { name: "chainId", type: "shortstring" },
12195
+ { name: "revision", type: "shortstring" }
12196
+ ];
12197
+ var OFFER_ITEM = [
12198
+ { name: "item_type", type: "shortstring" },
12199
+ { name: "token", type: "ContractAddress" },
12200
+ { name: "identifier_or_criteria", type: "felt" },
12201
+ { name: "amount", type: "felt" }
12202
+ ];
12203
+ var CONSIDERATION_ITEM = [
12204
+ { name: "item_type", type: "shortstring" },
12205
+ { name: "token", type: "ContractAddress" },
12206
+ { name: "identifier_or_criteria", type: "felt" },
12207
+ { name: "amount", type: "felt" },
12208
+ { name: "recipient", type: "ContractAddress" }
12209
+ ];
12210
+ var ORDER_PARAMETERS = [
12211
+ { name: "offerer", type: "ContractAddress" },
12212
+ { name: "marketplace", type: "ContractAddress" },
12213
+ { name: "offer", type: "OfferItem" },
12214
+ { name: "consideration", type: "ConsiderationItem" },
12215
+ { name: "royalty_max_bps", type: "felt" },
12216
+ { name: "start_time", type: "felt" },
12217
+ { name: "end_time", type: "felt" },
12218
+ { name: "salt", type: "felt" },
12219
+ { name: "counter", type: "felt" }
12220
+ ];
12221
+ var ORDER_CANCELLATION = [
12222
+ { name: "order_hash", type: "felt" },
12223
+ { name: "offerer", type: "ContractAddress" }
12224
+ ];
12225
+ var DOMAIN_VERSION = {
12226
+ erc721: "5",
12227
+ erc1155: "4"
12228
+ };
12229
+ function buildDomain(standard, chainId) {
12230
+ return {
12231
+ name: "Medialane",
12232
+ version: DOMAIN_VERSION[standard],
12233
+ chainId,
12234
+ revision: TypedDataRevision.ACTIVE
12235
+ };
12236
+ }
12237
+ function buildOrderTypedData(message, chainId) {
12238
+ return {
12239
+ domain: buildDomain("erc721", chainId),
12240
+ primaryType: "OrderParameters",
12241
+ types: {
12242
+ StarknetDomain: STARKNET_DOMAIN,
12243
+ OrderParameters: ORDER_PARAMETERS,
12244
+ OfferItem: OFFER_ITEM,
12245
+ ConsiderationItem: CONSIDERATION_ITEM
12246
+ },
12247
+ message
12248
+ };
12249
+ }
12250
+ function build1155OrderTypedData(message, chainId) {
12251
+ return {
12252
+ domain: buildDomain("erc1155", chainId),
12253
+ primaryType: "OrderParameters",
12254
+ types: {
12255
+ StarknetDomain: STARKNET_DOMAIN,
12256
+ OrderParameters: ORDER_PARAMETERS,
12257
+ OfferItem: OFFER_ITEM,
12258
+ ConsiderationItem: CONSIDERATION_ITEM
12259
+ },
12260
+ message
12261
+ };
12262
+ }
12263
+ function buildCancellationTypedData(message, chainId) {
12264
+ return {
12265
+ domain: buildDomain("erc721", chainId),
12266
+ primaryType: "OrderCancellation",
12267
+ types: {
12268
+ StarknetDomain: STARKNET_DOMAIN,
12269
+ OrderCancellation: ORDER_CANCELLATION
12270
+ },
12271
+ message
12272
+ };
12273
+ }
12274
+ function build1155CancellationTypedData(message, chainId) {
12275
+ return {
12276
+ domain: buildDomain("erc1155", chainId),
12277
+ primaryType: "OrderCancellation",
12278
+ types: {
12279
+ StarknetDomain: STARKNET_DOMAIN,
12280
+ OrderCancellation: ORDER_CANCELLATION
12281
+ },
12282
+ message
12283
+ };
12284
+ }
12285
+
12286
+ // src/starknet/marketplace/build.ts
12287
+ function contractFor(cfg) {
12288
+ return newContract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
12289
+ }
12290
+ function buildListingOrder(i, cfg) {
12291
+ const orderParams = {
12292
+ offerer: i.offerer,
12293
+ marketplace: cfg.marketplaceContract,
12294
+ offer: { item_type: "ERC721", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: "1" },
12295
+ consideration: {
12296
+ item_type: "ERC20",
12297
+ token: i.paymentTokenAddress,
12298
+ identifier_or_criteria: "0",
12299
+ amount: i.priceWei,
12300
+ recipient: i.offerer
12301
+ },
12302
+ royalty_max_bps: i.royaltyMaxBps,
12303
+ start_time: String(i.startTime),
12304
+ end_time: String(i.endTime),
12305
+ salt: i.salt,
12306
+ counter: i.counter
12307
+ };
12308
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
12309
+ return { orderParams, typedData };
12310
+ }
12311
+ function buildOfferOrder(i, cfg) {
12312
+ const orderParams = {
12313
+ offerer: i.offerer,
12314
+ marketplace: cfg.marketplaceContract,
12315
+ offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWei },
12316
+ consideration: {
12317
+ item_type: "ERC721",
12318
+ token: i.nftContract,
12319
+ identifier_or_criteria: i.tokenId,
12320
+ amount: "1",
12321
+ recipient: i.offerer
12322
+ },
12323
+ royalty_max_bps: i.royaltyMaxBps,
12324
+ start_time: String(i.startTime),
12325
+ end_time: String(i.endTime),
12326
+ salt: i.salt,
12327
+ counter: i.counter
12328
+ };
12329
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
12330
+ return { orderParams, typedData };
12331
+ }
12332
+ function registerPayload(orderParams, signature) {
12333
+ return stringifyBigInts({
12334
+ parameters: {
12335
+ ...orderParams,
12336
+ offer: { ...orderParams.offer, item_type: shortString.encodeShortString(orderParams.offer.item_type) },
12337
+ consideration: {
12338
+ ...orderParams.consideration,
12339
+ item_type: shortString.encodeShortString(orderParams.consideration.item_type)
12340
+ }
12341
+ },
12342
+ signature
12343
+ });
12344
+ }
12345
+ function buildRegisterCalls(a, cfg) {
12346
+ const registerCall = contractFor(cfg).populate("register_order", [registerPayload(a.orderParams, a.signature)]);
12347
+ return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
12348
+ }
12349
+ function buildFulfillCalls(a, cfg) {
12350
+ const u = cairo.uint256(a.totalPrice);
12351
+ const approve = {
12352
+ contractAddress: a.paymentToken,
12353
+ entrypoint: "approve",
12354
+ calldata: [cfg.marketplaceContract, u.low.toString(), u.high.toString()]
12355
+ };
12356
+ const fulfill = contractFor(cfg).populate("fulfill_order", [a.orderHash]);
12357
+ const fee = buildFeeCall(
12358
+ { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
12359
+ cfg.feeConfig
12360
+ );
12361
+ return fee ? [approve, fulfill, fee] : [approve, fulfill];
12362
+ }
12363
+ function buildCancelCalls(a, cfg) {
12364
+ const cancelRequest = stringifyBigInts({
12365
+ cancelation: { order_hash: a.orderHash, offerer: a.offerer },
12366
+ signature: a.signature
12367
+ });
12368
+ return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
12369
+ }
12370
+ function buildCancelTypedData(orderHash, offerer, cfg) {
12371
+ return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
12372
+ }
12373
+ function contractFor2(cfg) {
12374
+ return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
12375
+ }
12376
+ function buildListing1155Order(i, cfg) {
12377
+ const orderParams = {
12378
+ offerer: i.offerer,
12379
+ marketplace: cfg.marketplace1155Contract,
12380
+ offer: { item_type: "ERC1155", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: i.quantity },
12381
+ consideration: {
12382
+ item_type: "ERC20",
12383
+ token: i.paymentTokenAddress,
12384
+ identifier_or_criteria: "0",
12385
+ amount: i.priceWeiPerUnit,
12386
+ recipient: i.offerer
12387
+ },
12388
+ royalty_max_bps: i.royaltyMaxBps,
12389
+ start_time: String(i.startTime),
12390
+ end_time: String(i.endTime),
12391
+ salt: i.salt,
12392
+ counter: i.counter
12393
+ };
12394
+ const typedData = stringifyBigInts(
12395
+ build1155OrderTypedData(orderParams, getChainId(cfg))
12396
+ );
12397
+ return { orderParams, typedData };
12398
+ }
12399
+ function buildOffer1155Order(i, cfg) {
12400
+ const orderParams = {
12401
+ offerer: i.offerer,
12402
+ marketplace: cfg.marketplace1155Contract,
12403
+ offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWeiPerUnit },
12404
+ consideration: {
12405
+ item_type: "ERC1155",
12406
+ token: i.nftContract,
12407
+ identifier_or_criteria: i.tokenId,
12408
+ amount: i.quantity,
12409
+ recipient: i.offerer
12410
+ },
12411
+ royalty_max_bps: i.royaltyMaxBps,
12412
+ start_time: String(i.startTime),
12413
+ end_time: String(i.endTime),
12414
+ salt: i.salt,
12415
+ counter: i.counter
12416
+ };
12417
+ const typedData = stringifyBigInts(
12418
+ build1155OrderTypedData(orderParams, getChainId(cfg))
12419
+ );
12420
+ return { orderParams, typedData };
12421
+ }
12422
+ function registerPayload2(orderParams, signature) {
12423
+ return stringifyBigInts({
12424
+ parameters: {
12425
+ ...orderParams,
12426
+ offer: { ...orderParams.offer, item_type: shortString.encodeShortString(orderParams.offer.item_type) },
12427
+ consideration: {
12428
+ ...orderParams.consideration,
12429
+ item_type: shortString.encodeShortString(orderParams.consideration.item_type)
12430
+ }
12431
+ },
12432
+ signature
12433
+ });
12434
+ }
12435
+ function buildRegister1155Calls(a, cfg) {
12436
+ const registerCall = contractFor2(cfg).populate("register_order", [registerPayload2(a.orderParams, a.signature)]);
12437
+ return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
12438
+ }
12439
+ function buildFulfill1155Calls(a, cfg) {
12440
+ const u = cairo.uint256(a.totalPrice);
12441
+ const approve = {
12442
+ contractAddress: a.paymentToken,
12443
+ entrypoint: "approve",
12444
+ calldata: [cfg.marketplace1155Contract, u.low.toString(), u.high.toString()]
12445
+ };
12446
+ const fulfill = contractFor2(cfg).populate("fulfill_order", [a.orderHash, a.quantity]);
12447
+ const fee = buildFeeCall(
12448
+ { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
12449
+ cfg.feeConfig
12450
+ );
12451
+ return fee ? [approve, fulfill, fee] : [approve, fulfill];
12452
+ }
12453
+ function buildCancel1155Calls(a, cfg) {
12454
+ const cancelPayload = stringifyBigInts({
12455
+ cancelation: { order_hash: a.orderHash, offerer: a.offerer },
12456
+ signature: a.signature
12457
+ });
12458
+ return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
12459
+ }
12460
+ function buildCancel1155TypedData(orderHash, offerer, cfg) {
12461
+ return stringifyBigInts(
12462
+ build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
12463
+ );
12464
+ }
12465
+
12466
+ // src/starknet/venue.ts
13023
12467
  var NO_EXPIRY_SECONDS = 100 * 365 * 24 * 3600;
13024
12468
  var StarknetVenue = class {
13025
12469
  constructor(deps) {
@@ -13438,7 +12882,31 @@ function buybackQuoteRaw(teamCoinsRawValue, quoteDecimals) {
13438
12882
  function fdvHuman(supplyHuman) {
13439
12883
  return supplyHuman * LAUNCH_PRICE_QUOTE_PER_COIN;
13440
12884
  }
12885
+ function encodeByteArray(str) {
12886
+ const bytes = new TextEncoder().encode(str);
12887
+ const fullChunks = [];
12888
+ let i = 0;
12889
+ while (i + 31 <= bytes.length) {
12890
+ let val = 0n;
12891
+ for (const b of bytes.slice(i, i + 31)) {
12892
+ val = val << 8n | BigInt(b);
12893
+ }
12894
+ fullChunks.push(num.toHex(val));
12895
+ i += 31;
12896
+ }
12897
+ const remaining = bytes.slice(i);
12898
+ let pendingVal = 0n;
12899
+ for (const b of remaining) {
12900
+ pendingVal = pendingVal << 8n | BigInt(b);
12901
+ }
12902
+ return [
12903
+ fullChunks.length.toString(),
12904
+ ...fullChunks,
12905
+ num.toHex(pendingVal),
12906
+ remaining.length.toString()
12907
+ ];
12908
+ }
13441
12909
 
13442
- export { ADMIN_HEADERS, ADMIN_SCOPE, ApiClient, CHAINS, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DEFAULT_CHAIN, DEFAULT_CURRENCY, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPClubABI, IPClubCollectionABI, IPClubFactoryABI, IPClubNFTABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPSponsorshipLicenseABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, PUBLIC_RPC_FALLBACKS, PopService, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_EKUBO_CORE, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_CLUB_NFT_CLASS_HASH, STARKNET_IP_CLUB_REGISTRY_CONTRACT, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_SPONSORSHIP_LICENSE_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, SUPPORTED_TOKENS, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, createFailoverFetch, encodeAdminHeaders, encodeByteArray, fdvHuman, formatAmount, getCoordinates, getCreatorCoinPrice, getListableTokens, getService, getServicesByCapability, getSiwsStorageKey, getStarknetCoordinates, getStoredSiwsToken, getTokenByAddress, getTokenBySymbol, hasCapability, isServiceId, isSiwsTokenValid, isTransientRpcError, listServices, normalizeAddress, normalizeHash, normalizeSiwsSignature, parseAdminHeaders, parseAmount, parseCreatorCoinCreated, randomNonce, requestSiwsToken, resolveConfig, resolveFeeConfig, sessionKeyHashOf, shortenAddress, signAdminRequest, storeSiwsToken, stringifyBigInts, teamCoinsRaw, u256ToBigInt, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
12910
+ export { ADMIN_HEADERS, ADMIN_SCOPE, ApiClient, CHAINS, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DEFAULT_CHAIN, DEFAULT_CURRENCY, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPClubABI, IPClubCollectionABI, IPClubFactoryABI, IPClubNFTABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPSponsorshipLicenseABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneApiError, MedialaneClient, MedialaneError, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, PUBLIC_RPC_FALLBACKS, PopService, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_EKUBO_CORE, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_CLUB_NFT_CLASS_HASH, STARKNET_IP_CLUB_REGISTRY_CONTRACT, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_SPONSORSHIP_LICENSE_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, SUPPORTED_TOKENS, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, createFailoverFetch, encodeAdminHeaders, encodeByteArray, fdvHuman, formatAmount, getCoordinates, getCounter, getCounter1155, getCreatorCoinPrice, getListableTokens, getOrderDetails, getOrderDetails1155, getService, getServicesByCapability, getSiwsStorageKey, getStarknetCoordinates, getStoredSiwsToken, getTokenByAddress, getTokenBySymbol, hasCapability, isServiceId, isSiwsTokenValid, isTransientRpcError, listServices, normalizeAddress, normalizeHash, normalizeSiwsSignature, parseAdminHeaders, parseAmount, parseCreatorCoinCreated, randomNonce, requestSiwsToken, resolveConfig, resolveFeeConfig, sessionKeyHashOf, shortenAddress, signAdminRequest, storeSiwsToken, stringifyBigInts, teamCoinsRaw, u256ToBigInt, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
13443
12911
  //# sourceMappingURL=index.js.map
13444
12912
  //# sourceMappingURL=index.js.map