@medialane/sdk 0.64.1 → 0.66.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/evm/index.cjs +4 -3
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/index.js +4 -3
- package/dist/evm/index.js.map +1 -1
- package/dist/{index-DMNv-Oj0.d.ts → index-C2EaTkzk.d.cts} +60 -67
- package/dist/{index-_q2B0g3M.d.cts → index-DjJ4k6p_.d.ts} +60 -67
- package/dist/index.cjs +145 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +146 -142
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +4 -3
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1 -1
- package/dist/solana/index.d.ts +1 -1
- package/dist/solana/index.js +4 -3
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +256 -261
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -2
- package/dist/starknet/index.d.ts +2 -2
- package/dist/starknet/index.js +257 -262
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +4 -3
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.d.cts +1 -1
- package/dist/stellar/index.d.ts +1 -1
- package/dist/stellar/index.js +4 -3
- package/dist/stellar/index.js.map +1 -1
- package/dist/{types-Bx3ax9lW.d.cts → types-CIR6H6ul.d.cts} +1 -0
- package/dist/{types-Bx3ax9lW.d.ts → types-CIR6H6ul.d.ts} +1 -0
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -37,9 +37,10 @@ var COORDINATES = {
|
|
|
37
37
|
creatorCoinFactoryClassHash: "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55",
|
|
38
38
|
creatorCoinStartBlock: 10474544,
|
|
39
39
|
ekuboCore: "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b",
|
|
40
|
-
ipTicketsFactory: "
|
|
41
|
-
ipTicketCollectionClassHash: "
|
|
42
|
-
|
|
40
|
+
ipTicketsFactory: "0x059802639b41e9c6449c3d557703e610ef639a91866dc1dd44216f9f37111ac5",
|
|
41
|
+
ipTicketCollectionClassHash: "0x047bd108881457c4f4db6c64671c1dd402f4d8c79fd9182f03a2dd841335a34b",
|
|
42
|
+
ipTicketsFactoryClassHash: "0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a",
|
|
43
|
+
ipTicketsStartBlock: 11836622,
|
|
43
44
|
ipClubRegistry: "0x00e189c619b6bb07d78973a149641c59c37eb0716f8584d7520bce12d303eede",
|
|
44
45
|
ipClubNftClassHash: "0x02bc9b20cca21b04245e9215bf7121f4d7295b195890e449b472b573017fb889",
|
|
45
46
|
ipClubStartBlock: 11404776,
|
|
@@ -1041,13 +1042,20 @@ var SERVICES = {
|
|
|
1041
1042
|
"ip-tickets": {
|
|
1042
1043
|
id: "ip-tickets",
|
|
1043
1044
|
displayName: "IP Tickets",
|
|
1044
|
-
description: "
|
|
1045
|
-
standard: "
|
|
1045
|
+
description: "Create verifiable on-chain tickets \u2014 mint to attendees, trade like any collection.",
|
|
1046
|
+
standard: "ERC1155",
|
|
1046
1047
|
provenance: "MEDIALANE",
|
|
1048
|
+
onchain: {
|
|
1049
|
+
STARKNET: {
|
|
1050
|
+
factoryAddress: SN2.ipTicketsFactory,
|
|
1051
|
+
classHash: SN2.ipTicketCollectionClassHash
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1047
1054
|
uiVariant: "ticket",
|
|
1048
|
-
capabilities: ["mint", "redeem", "transfer"],
|
|
1055
|
+
capabilities: ["mint", "redeem", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
1049
1056
|
events: [
|
|
1050
|
-
{ name: "CollectionDeployed", emittedBy: "factory" }
|
|
1057
|
+
{ name: "CollectionDeployed", emittedBy: "factory" },
|
|
1058
|
+
{ name: "TicketCreated", emittedBy: "instance" }
|
|
1051
1059
|
],
|
|
1052
1060
|
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
1053
1061
|
},
|
|
@@ -1297,6 +1305,50 @@ function createFailoverFetch(urls, options = {}) {
|
|
|
1297
1305
|
return failover;
|
|
1298
1306
|
}
|
|
1299
1307
|
|
|
1308
|
+
// src/starknet/marketplace/errors.ts
|
|
1309
|
+
var MedialaneError = class extends Error {
|
|
1310
|
+
constructor(message, code = "UNKNOWN", cause) {
|
|
1311
|
+
super(message);
|
|
1312
|
+
this.code = code;
|
|
1313
|
+
this.cause = cause;
|
|
1314
|
+
this.name = "MedialaneError";
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
// src/starknet/marketplace/utils.ts
|
|
1319
|
+
var START_TIME_BUFFER_SECS = 30;
|
|
1320
|
+
function newContract(abi, address, providerOrAccount) {
|
|
1321
|
+
const C = starknet.Contract;
|
|
1322
|
+
return C.length === 1 ? new starknet.Contract({ abi, address, providerOrAccount }) : new starknet.Contract(
|
|
1323
|
+
abi,
|
|
1324
|
+
address,
|
|
1325
|
+
providerOrAccount
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
function getChainId(config) {
|
|
1329
|
+
if (config.chain !== "STARKNET") {
|
|
1330
|
+
throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
|
|
1331
|
+
}
|
|
1332
|
+
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
1333
|
+
}
|
|
1334
|
+
function resolveToken(currency) {
|
|
1335
|
+
const token = SUPPORTED_TOKENS.find(
|
|
1336
|
+
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
1337
|
+
);
|
|
1338
|
+
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
1339
|
+
return token;
|
|
1340
|
+
}
|
|
1341
|
+
var _providerCache = /* @__PURE__ */ new WeakMap();
|
|
1342
|
+
function getProvider(config) {
|
|
1343
|
+
let p = _providerCache.get(config);
|
|
1344
|
+
if (!p) {
|
|
1345
|
+
const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
|
|
1346
|
+
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
1347
|
+
_providerCache.set(config, p);
|
|
1348
|
+
}
|
|
1349
|
+
return p;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1300
1352
|
// src/starknet/abis/ipMarketplace.ts
|
|
1301
1353
|
var IPMarketplaceABI = [
|
|
1302
1354
|
{
|
|
@@ -5795,12 +5847,8 @@ var IPTicketCollectionABI = [
|
|
|
5795
5847
|
},
|
|
5796
5848
|
{
|
|
5797
5849
|
"type": "struct",
|
|
5798
|
-
"name": "ip_ticket::types::
|
|
5850
|
+
"name": "ip_ticket::types::Ticket",
|
|
5799
5851
|
"members": [
|
|
5800
|
-
{
|
|
5801
|
-
"name": "creator",
|
|
5802
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
5803
|
-
},
|
|
5804
5852
|
{
|
|
5805
5853
|
"name": "max_supply",
|
|
5806
5854
|
"type": "core::integer::u256"
|
|
@@ -5824,10 +5872,6 @@ var IPTicketCollectionABI = [
|
|
|
5824
5872
|
{
|
|
5825
5873
|
"name": "metadata_uri",
|
|
5826
5874
|
"type": "core::byte_array::ByteArray"
|
|
5827
|
-
},
|
|
5828
|
-
{
|
|
5829
|
-
"name": "active",
|
|
5830
|
-
"type": "core::bool"
|
|
5831
5875
|
}
|
|
5832
5876
|
]
|
|
5833
5877
|
},
|
|
@@ -5837,7 +5881,7 @@ var IPTicketCollectionABI = [
|
|
|
5837
5881
|
"items": [
|
|
5838
5882
|
{
|
|
5839
5883
|
"type": "function",
|
|
5840
|
-
"name": "
|
|
5884
|
+
"name": "create_ticket",
|
|
5841
5885
|
"inputs": [
|
|
5842
5886
|
{
|
|
5843
5887
|
"name": "max_supply",
|
|
@@ -5889,52 +5933,69 @@ var IPTicketCollectionABI = [
|
|
|
5889
5933
|
},
|
|
5890
5934
|
{
|
|
5891
5935
|
"type": "function",
|
|
5892
|
-
"name": "
|
|
5936
|
+
"name": "is_valid",
|
|
5893
5937
|
"inputs": [
|
|
5894
5938
|
{
|
|
5895
5939
|
"name": "token_id",
|
|
5896
5940
|
"type": "core::integer::u256"
|
|
5897
5941
|
},
|
|
5898
5942
|
{
|
|
5899
|
-
"name": "
|
|
5943
|
+
"name": "holder",
|
|
5944
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
5945
|
+
}
|
|
5946
|
+
],
|
|
5947
|
+
"outputs": [
|
|
5948
|
+
{
|
|
5900
5949
|
"type": "core::bool"
|
|
5901
5950
|
}
|
|
5902
5951
|
],
|
|
5903
|
-
"
|
|
5904
|
-
"state_mutability": "external"
|
|
5952
|
+
"state_mutability": "view"
|
|
5905
5953
|
},
|
|
5906
5954
|
{
|
|
5907
5955
|
"type": "function",
|
|
5908
|
-
"name": "
|
|
5956
|
+
"name": "get_ticket",
|
|
5909
5957
|
"inputs": [
|
|
5910
5958
|
{
|
|
5911
5959
|
"name": "token_id",
|
|
5912
5960
|
"type": "core::integer::u256"
|
|
5913
|
-
}
|
|
5961
|
+
}
|
|
5962
|
+
],
|
|
5963
|
+
"outputs": [
|
|
5914
5964
|
{
|
|
5915
|
-
"
|
|
5916
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
5965
|
+
"type": "ip_ticket::types::Ticket"
|
|
5917
5966
|
}
|
|
5918
5967
|
],
|
|
5968
|
+
"state_mutability": "view"
|
|
5969
|
+
},
|
|
5970
|
+
{
|
|
5971
|
+
"type": "function",
|
|
5972
|
+
"name": "name",
|
|
5973
|
+
"inputs": [],
|
|
5919
5974
|
"outputs": [
|
|
5920
5975
|
{
|
|
5921
|
-
"type": "core::
|
|
5976
|
+
"type": "core::byte_array::ByteArray"
|
|
5922
5977
|
}
|
|
5923
5978
|
],
|
|
5924
5979
|
"state_mutability": "view"
|
|
5925
5980
|
},
|
|
5926
5981
|
{
|
|
5927
5982
|
"type": "function",
|
|
5928
|
-
"name": "
|
|
5929
|
-
"inputs": [
|
|
5983
|
+
"name": "symbol",
|
|
5984
|
+
"inputs": [],
|
|
5985
|
+
"outputs": [
|
|
5930
5986
|
{
|
|
5931
|
-
"
|
|
5932
|
-
"type": "core::integer::u256"
|
|
5987
|
+
"type": "core::byte_array::ByteArray"
|
|
5933
5988
|
}
|
|
5934
5989
|
],
|
|
5990
|
+
"state_mutability": "view"
|
|
5991
|
+
},
|
|
5992
|
+
{
|
|
5993
|
+
"type": "function",
|
|
5994
|
+
"name": "base_uri",
|
|
5995
|
+
"inputs": [],
|
|
5935
5996
|
"outputs": [
|
|
5936
5997
|
{
|
|
5937
|
-
"type": "
|
|
5998
|
+
"type": "core::byte_array::ByteArray"
|
|
5938
5999
|
}
|
|
5939
6000
|
],
|
|
5940
6001
|
"state_mutability": "view"
|
|
@@ -6407,6 +6468,10 @@ var IPTicketCollectionABI = [
|
|
|
6407
6468
|
"name": "symbol",
|
|
6408
6469
|
"type": "core::byte_array::ByteArray"
|
|
6409
6470
|
},
|
|
6471
|
+
{
|
|
6472
|
+
"name": "base_uri",
|
|
6473
|
+
"type": "core::byte_array::ByteArray"
|
|
6474
|
+
},
|
|
6410
6475
|
{
|
|
6411
6476
|
"name": "owner",
|
|
6412
6477
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
@@ -6602,7 +6667,7 @@ var IPTicketCollectionABI = [
|
|
|
6602
6667
|
},
|
|
6603
6668
|
{
|
|
6604
6669
|
"type": "event",
|
|
6605
|
-
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::
|
|
6670
|
+
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCreated",
|
|
6606
6671
|
"kind": "struct",
|
|
6607
6672
|
"members": [
|
|
6608
6673
|
{
|
|
@@ -6637,23 +6702,6 @@ var IPTicketCollectionABI = [
|
|
|
6637
6702
|
}
|
|
6638
6703
|
]
|
|
6639
6704
|
},
|
|
6640
|
-
{
|
|
6641
|
-
"type": "event",
|
|
6642
|
-
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
|
|
6643
|
-
"kind": "struct",
|
|
6644
|
-
"members": [
|
|
6645
|
-
{
|
|
6646
|
-
"name": "token_id",
|
|
6647
|
-
"type": "core::integer::u256",
|
|
6648
|
-
"kind": "key"
|
|
6649
|
-
},
|
|
6650
|
-
{
|
|
6651
|
-
"name": "active",
|
|
6652
|
-
"type": "core::bool",
|
|
6653
|
-
"kind": "data"
|
|
6654
|
-
}
|
|
6655
|
-
]
|
|
6656
|
-
},
|
|
6657
6705
|
{
|
|
6658
6706
|
"type": "event",
|
|
6659
6707
|
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::Event",
|
|
@@ -6675,13 +6723,8 @@ var IPTicketCollectionABI = [
|
|
|
6675
6723
|
"kind": "flat"
|
|
6676
6724
|
},
|
|
6677
6725
|
{
|
|
6678
|
-
"name": "
|
|
6679
|
-
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::
|
|
6680
|
-
"kind": "nested"
|
|
6681
|
-
},
|
|
6682
|
-
{
|
|
6683
|
-
"name": "EventPaused",
|
|
6684
|
-
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
|
|
6726
|
+
"name": "TicketCreated",
|
|
6727
|
+
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCreated",
|
|
6685
6728
|
"kind": "nested"
|
|
6686
6729
|
}
|
|
6687
6730
|
]
|
|
@@ -6750,6 +6793,10 @@ var IPTicketCollectionFactoryABI = [
|
|
|
6750
6793
|
{
|
|
6751
6794
|
"name": "symbol",
|
|
6752
6795
|
"type": "core::byte_array::ByteArray"
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
"name": "base_uri",
|
|
6799
|
+
"type": "core::byte_array::ByteArray"
|
|
6753
6800
|
}
|
|
6754
6801
|
],
|
|
6755
6802
|
"outputs": [
|
|
@@ -11332,7 +11379,7 @@ var PopService = class {
|
|
|
11332
11379
|
this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
|
|
11333
11380
|
}
|
|
11334
11381
|
_collection(address, account) {
|
|
11335
|
-
return
|
|
11382
|
+
return newContract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11336
11383
|
}
|
|
11337
11384
|
async claim(account, collectionAddress) {
|
|
11338
11385
|
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
@@ -11381,7 +11428,7 @@ var PopService = class {
|
|
|
11381
11428
|
return { txHash: res.transaction_hash };
|
|
11382
11429
|
}
|
|
11383
11430
|
async createCollection(account, params) {
|
|
11384
|
-
const factory =
|
|
11431
|
+
const factory = newContract(POPFactoryABI, this.factoryAddress, account);
|
|
11385
11432
|
const call = factory.populate("create_collection", [
|
|
11386
11433
|
params.name,
|
|
11387
11434
|
params.symbol,
|
|
@@ -11423,7 +11470,7 @@ var DropService = class {
|
|
|
11423
11470
|
this.config = config;
|
|
11424
11471
|
}
|
|
11425
11472
|
_collection(address, account) {
|
|
11426
|
-
return
|
|
11473
|
+
return newContract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11427
11474
|
}
|
|
11428
11475
|
async claim(account, collectionAddress, quantity = 1) {
|
|
11429
11476
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -11487,7 +11534,7 @@ var DropService = class {
|
|
|
11487
11534
|
return { txHash: res.transaction_hash };
|
|
11488
11535
|
}
|
|
11489
11536
|
async createDrop(account, params) {
|
|
11490
|
-
const factory =
|
|
11537
|
+
const factory = newContract(DropFactoryABI, this.factoryAddress, account);
|
|
11491
11538
|
const call = factory.populate("create_drop", [
|
|
11492
11539
|
params.name,
|
|
11493
11540
|
params.symbol,
|
|
@@ -11499,19 +11546,21 @@ var DropService = class {
|
|
|
11499
11546
|
return { txHash: res.transaction_hash };
|
|
11500
11547
|
}
|
|
11501
11548
|
};
|
|
11549
|
+
|
|
11550
|
+
// src/starknet/services/erc1155collection.ts
|
|
11502
11551
|
var ERC1155CollectionService = class {
|
|
11503
11552
|
constructor(config) {
|
|
11504
11553
|
this.factoryAddress = config.collection1155Contract ?? getStarknetCoordinates(config.chain).collection1155;
|
|
11505
11554
|
}
|
|
11506
11555
|
_factory(account) {
|
|
11507
|
-
return
|
|
11556
|
+
return newContract(
|
|
11508
11557
|
IPCollection1155FactoryABI,
|
|
11509
11558
|
normalizeAddress("STARKNET", this.factoryAddress),
|
|
11510
11559
|
account
|
|
11511
11560
|
);
|
|
11512
11561
|
}
|
|
11513
11562
|
_collection(address, account) {
|
|
11514
|
-
return
|
|
11563
|
+
return newContract(
|
|
11515
11564
|
IPCollection1155ABI,
|
|
11516
11565
|
normalizeAddress("STARKNET", address),
|
|
11517
11566
|
account
|
|
@@ -11656,7 +11705,7 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
11656
11705
|
var _factoryContract = null;
|
|
11657
11706
|
function factoryContract() {
|
|
11658
11707
|
if (!_factoryContract) {
|
|
11659
|
-
_factoryContract =
|
|
11708
|
+
_factoryContract = newContract(
|
|
11660
11709
|
CreatorCoinFactoryABI,
|
|
11661
11710
|
getStarknetCoordinates("STARKNET").creatorCoinFactory
|
|
11662
11711
|
);
|
|
@@ -11726,7 +11775,7 @@ var CreatorCoinService = class {
|
|
|
11726
11775
|
this.config = config;
|
|
11727
11776
|
}
|
|
11728
11777
|
_factory(account) {
|
|
11729
|
-
return
|
|
11778
|
+
return newContract(CreatorCoinFactoryABI, this.factoryAddress, account);
|
|
11730
11779
|
}
|
|
11731
11780
|
/** Deploy a fixed-supply CreatorCoin (full supply minted to the Factory). */
|
|
11732
11781
|
async createCreatorCoin(account, params) {
|
|
@@ -11761,26 +11810,34 @@ var TicketService = class {
|
|
|
11761
11810
|
_factory(account, factoryAddress) {
|
|
11762
11811
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11763
11812
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
11764
|
-
return
|
|
11813
|
+
return newContract(IPTicketCollectionFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
11765
11814
|
}
|
|
11766
11815
|
_collection(address, account) {
|
|
11767
|
-
return
|
|
11816
|
+
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11768
11817
|
}
|
|
11769
11818
|
_collectionRead(address) {
|
|
11770
11819
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11771
|
-
return
|
|
11820
|
+
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
11772
11821
|
}
|
|
11773
|
-
/**
|
|
11822
|
+
/**
|
|
11823
|
+
* Deploys a new IPTicketCollection via the factory. Caller becomes owner.
|
|
11824
|
+
* `baseUri` is the collection-level metadata URI, embedded on-chain in the
|
|
11825
|
+
* deploy transaction.
|
|
11826
|
+
*/
|
|
11774
11827
|
async deployCollection(account, params) {
|
|
11775
|
-
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11828
|
+
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11829
|
+
params.name,
|
|
11830
|
+
params.symbol,
|
|
11831
|
+
params.baseUri
|
|
11832
|
+
]);
|
|
11776
11833
|
const res = await account.execute([call]);
|
|
11777
11834
|
return { txHash: res.transaction_hash };
|
|
11778
11835
|
}
|
|
11779
|
-
/** Owner-only. Creates a new
|
|
11780
|
-
async
|
|
11836
|
+
/** Owner-only. Creates a new ticket inside the caller's deployed collection. */
|
|
11837
|
+
async createTicket(account, params) {
|
|
11781
11838
|
const startTime = params.startTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.startTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
11782
11839
|
const endTime = params.endTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.endTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
11783
|
-
const call = this._collection(params.collection, account).populate("
|
|
11840
|
+
const call = this._collection(params.collection, account).populate("create_ticket", [
|
|
11784
11841
|
starknet.cairo.uint256(params.maxSupply),
|
|
11785
11842
|
startTime,
|
|
11786
11843
|
endTime,
|
|
@@ -11800,16 +11857,7 @@ var TicketService = class {
|
|
|
11800
11857
|
const res = await account.execute([call]);
|
|
11801
11858
|
return { txHash: res.transaction_hash };
|
|
11802
11859
|
}
|
|
11803
|
-
/**
|
|
11804
|
-
async pauseEvent(account, params) {
|
|
11805
|
-
const call = this._collection(params.collection, account).populate("pause_event", [
|
|
11806
|
-
starknet.cairo.uint256(params.tokenId),
|
|
11807
|
-
params.active
|
|
11808
|
-
]);
|
|
11809
|
-
const res = await account.execute([call]);
|
|
11810
|
-
return { txHash: res.transaction_hash };
|
|
11811
|
-
}
|
|
11812
|
-
/** Read — true if holder has balance > 0 and current time is within the event window. */
|
|
11860
|
+
/** Read — true if holder has balance > 0 and current time is within the ticket window. */
|
|
11813
11861
|
async isValid(params) {
|
|
11814
11862
|
const result = await this._collectionRead(params.collection).call("is_valid", [
|
|
11815
11863
|
starknet.cairo.uint256(params.tokenId),
|
|
@@ -11817,20 +11865,18 @@ var TicketService = class {
|
|
|
11817
11865
|
]);
|
|
11818
11866
|
return Boolean(result);
|
|
11819
11867
|
}
|
|
11820
|
-
/** Read — returns the
|
|
11821
|
-
async
|
|
11822
|
-
const
|
|
11868
|
+
/** Read — returns the Ticket record for a token ID. */
|
|
11869
|
+
async getTicket(params) {
|
|
11870
|
+
const t = await this._collectionRead(params.collection).call("get_ticket", [
|
|
11823
11871
|
starknet.cairo.uint256(params.tokenId)
|
|
11824
11872
|
]);
|
|
11825
11873
|
return {
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
metadataUri: ev.metadata_uri,
|
|
11833
|
-
active: Boolean(ev.active)
|
|
11874
|
+
maxSupply: BigInt(t.max_supply),
|
|
11875
|
+
minted: BigInt(t.minted),
|
|
11876
|
+
startTime: t.start_time?.variant === "Some" ? Number(t.start_time.values[0] ?? t.start_time.value) : null,
|
|
11877
|
+
endTime: t.end_time?.variant === "Some" ? Number(t.end_time.values[0] ?? t.end_time.value) : null,
|
|
11878
|
+
royaltyBps: Number(t.royalty_bps),
|
|
11879
|
+
metadataUri: t.metadata_uri
|
|
11834
11880
|
};
|
|
11835
11881
|
}
|
|
11836
11882
|
};
|
|
@@ -11843,15 +11889,15 @@ var ClubService = class {
|
|
|
11843
11889
|
_registry(account, registryAddress) {
|
|
11844
11890
|
const address = registryAddress ?? this.registryAddress;
|
|
11845
11891
|
if (!address) throw new Error("IP-Club registry address not configured for this chain");
|
|
11846
|
-
return
|
|
11892
|
+
return newContract(IPClubABI, normalizeAddress("STARKNET", address), account);
|
|
11847
11893
|
}
|
|
11848
11894
|
_factory(account, factoryAddress) {
|
|
11849
11895
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11850
11896
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11851
|
-
return
|
|
11897
|
+
return newContract(IPClubFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
11852
11898
|
}
|
|
11853
11899
|
_collection(account, collectionAddress) {
|
|
11854
|
-
return
|
|
11900
|
+
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", collectionAddress), account);
|
|
11855
11901
|
}
|
|
11856
11902
|
/** Deploy a new per-creator membership ERC-721 collection via the factory. */
|
|
11857
11903
|
async deployClub(account, params) {
|
|
@@ -11963,7 +12009,7 @@ var SponsorshipService = class {
|
|
|
11963
12009
|
if (!resolved) {
|
|
11964
12010
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11965
12011
|
}
|
|
11966
|
-
return
|
|
12012
|
+
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), account);
|
|
11967
12013
|
}
|
|
11968
12014
|
/** The offer author must currently own (nftContract, tokenId) — enforced on-chain at create and accept. */
|
|
11969
12015
|
async createOffer(account, params) {
|
|
@@ -12032,7 +12078,7 @@ var SponsorshipService = class {
|
|
|
12032
12078
|
starknet.cairo.uint256(params.offerId),
|
|
12033
12079
|
params.sponsor
|
|
12034
12080
|
]);
|
|
12035
|
-
const receipt =
|
|
12081
|
+
const receipt = newContract(IPGenesisABI, normalizeAddress("STARKNET", receiptAddress), account);
|
|
12036
12082
|
const mintCall = receipt.populate("mint_item", [params.sponsor, params.licenseTermsUri]);
|
|
12037
12083
|
const res = await account.execute([acceptCall, mintCall]);
|
|
12038
12084
|
return { txHash: res.transaction_hash };
|
|
@@ -12052,7 +12098,7 @@ var SponsorshipService = class {
|
|
|
12052
12098
|
];
|
|
12053
12099
|
const receiptAddress = params.licenseReceiptAddress ?? this.licenseReceiptAddress;
|
|
12054
12100
|
if (receiptAddress && params.receiptTokenId != null) {
|
|
12055
|
-
const receipt =
|
|
12101
|
+
const receipt = newContract(IPGenesisABI, normalizeAddress("STARKNET", receiptAddress), account);
|
|
12056
12102
|
calls.push(receipt.populate("transfer_from", [account.address, params.to, starknet.cairo.uint256(params.receiptTokenId)]));
|
|
12057
12103
|
}
|
|
12058
12104
|
const res = await account.execute(calls);
|
|
@@ -12107,48 +12153,6 @@ var MedialaneClient = class {
|
|
|
12107
12153
|
}
|
|
12108
12154
|
};
|
|
12109
12155
|
|
|
12110
|
-
// src/starknet/marketplace/errors.ts
|
|
12111
|
-
var MedialaneError = class extends Error {
|
|
12112
|
-
constructor(message, code = "UNKNOWN", cause) {
|
|
12113
|
-
super(message);
|
|
12114
|
-
this.code = code;
|
|
12115
|
-
this.cause = cause;
|
|
12116
|
-
this.name = "MedialaneError";
|
|
12117
|
-
}
|
|
12118
|
-
};
|
|
12119
|
-
var START_TIME_BUFFER_SECS = 30;
|
|
12120
|
-
function newContract(abi, address, providerOrAccount) {
|
|
12121
|
-
const C = starknet.Contract;
|
|
12122
|
-
return C.length === 1 ? new starknet.Contract({ abi, address, providerOrAccount }) : new starknet.Contract(
|
|
12123
|
-
abi,
|
|
12124
|
-
address,
|
|
12125
|
-
providerOrAccount
|
|
12126
|
-
);
|
|
12127
|
-
}
|
|
12128
|
-
function getChainId(config) {
|
|
12129
|
-
if (config.chain !== "STARKNET") {
|
|
12130
|
-
throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
|
|
12131
|
-
}
|
|
12132
|
-
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
12133
|
-
}
|
|
12134
|
-
function resolveToken(currency) {
|
|
12135
|
-
const token = SUPPORTED_TOKENS.find(
|
|
12136
|
-
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
12137
|
-
);
|
|
12138
|
-
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
12139
|
-
return token;
|
|
12140
|
-
}
|
|
12141
|
-
var _providerCache = /* @__PURE__ */ new WeakMap();
|
|
12142
|
-
function getProvider(config) {
|
|
12143
|
-
let p = _providerCache.get(config);
|
|
12144
|
-
if (!p) {
|
|
12145
|
-
const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
|
|
12146
|
-
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
12147
|
-
_providerCache.set(config, p);
|
|
12148
|
-
}
|
|
12149
|
-
return p;
|
|
12150
|
-
}
|
|
12151
|
-
|
|
12152
12156
|
// src/starknet/marketplace/orders.ts
|
|
12153
12157
|
var _contractCache = /* @__PURE__ */ new WeakMap();
|
|
12154
12158
|
function makeContract(config) {
|