@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.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,
|
|
4
|
+
import { hash, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, encode, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
|
|
6
6
|
// src/config.ts
|
|
7
7
|
|
|
@@ -35,9 +35,10 @@ var COORDINATES = {
|
|
|
35
35
|
creatorCoinFactoryClassHash: "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55",
|
|
36
36
|
creatorCoinStartBlock: 10474544,
|
|
37
37
|
ekuboCore: "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b",
|
|
38
|
-
ipTicketsFactory: "
|
|
39
|
-
ipTicketCollectionClassHash: "
|
|
40
|
-
|
|
38
|
+
ipTicketsFactory: "0x059802639b41e9c6449c3d557703e610ef639a91866dc1dd44216f9f37111ac5",
|
|
39
|
+
ipTicketCollectionClassHash: "0x047bd108881457c4f4db6c64671c1dd402f4d8c79fd9182f03a2dd841335a34b",
|
|
40
|
+
ipTicketsFactoryClassHash: "0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a",
|
|
41
|
+
ipTicketsStartBlock: 11836622,
|
|
41
42
|
ipClubRegistry: "0x00e189c619b6bb07d78973a149641c59c37eb0716f8584d7520bce12d303eede",
|
|
42
43
|
ipClubNftClassHash: "0x02bc9b20cca21b04245e9215bf7121f4d7295b195890e449b472b573017fb889",
|
|
43
44
|
ipClubStartBlock: 11404776,
|
|
@@ -1039,13 +1040,20 @@ var SERVICES = {
|
|
|
1039
1040
|
"ip-tickets": {
|
|
1040
1041
|
id: "ip-tickets",
|
|
1041
1042
|
displayName: "IP Tickets",
|
|
1042
|
-
description: "
|
|
1043
|
-
standard: "
|
|
1043
|
+
description: "Create verifiable on-chain tickets \u2014 mint to attendees, trade like any collection.",
|
|
1044
|
+
standard: "ERC1155",
|
|
1044
1045
|
provenance: "MEDIALANE",
|
|
1046
|
+
onchain: {
|
|
1047
|
+
STARKNET: {
|
|
1048
|
+
factoryAddress: SN2.ipTicketsFactory,
|
|
1049
|
+
classHash: SN2.ipTicketCollectionClassHash
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1045
1052
|
uiVariant: "ticket",
|
|
1046
|
-
capabilities: ["mint", "redeem", "transfer"],
|
|
1053
|
+
capabilities: ["mint", "redeem", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
1047
1054
|
events: [
|
|
1048
|
-
{ name: "CollectionDeployed", emittedBy: "factory" }
|
|
1055
|
+
{ name: "CollectionDeployed", emittedBy: "factory" },
|
|
1056
|
+
{ name: "TicketCreated", emittedBy: "instance" }
|
|
1049
1057
|
],
|
|
1050
1058
|
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
1051
1059
|
},
|
|
@@ -1295,6 +1303,50 @@ function createFailoverFetch(urls, options = {}) {
|
|
|
1295
1303
|
return failover;
|
|
1296
1304
|
}
|
|
1297
1305
|
|
|
1306
|
+
// src/starknet/marketplace/errors.ts
|
|
1307
|
+
var MedialaneError = class extends Error {
|
|
1308
|
+
constructor(message, code = "UNKNOWN", cause) {
|
|
1309
|
+
super(message);
|
|
1310
|
+
this.code = code;
|
|
1311
|
+
this.cause = cause;
|
|
1312
|
+
this.name = "MedialaneError";
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
// src/starknet/marketplace/utils.ts
|
|
1317
|
+
var START_TIME_BUFFER_SECS = 30;
|
|
1318
|
+
function newContract(abi, address, providerOrAccount) {
|
|
1319
|
+
const C = Contract;
|
|
1320
|
+
return C.length === 1 ? new Contract({ abi, address, providerOrAccount }) : new Contract(
|
|
1321
|
+
abi,
|
|
1322
|
+
address,
|
|
1323
|
+
providerOrAccount
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
function getChainId(config) {
|
|
1327
|
+
if (config.chain !== "STARKNET") {
|
|
1328
|
+
throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
|
|
1329
|
+
}
|
|
1330
|
+
return constants.StarknetChainId.SN_MAIN;
|
|
1331
|
+
}
|
|
1332
|
+
function resolveToken(currency) {
|
|
1333
|
+
const token = SUPPORTED_TOKENS.find(
|
|
1334
|
+
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
1335
|
+
);
|
|
1336
|
+
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
1337
|
+
return token;
|
|
1338
|
+
}
|
|
1339
|
+
var _providerCache = /* @__PURE__ */ new WeakMap();
|
|
1340
|
+
function getProvider(config) {
|
|
1341
|
+
let p = _providerCache.get(config);
|
|
1342
|
+
if (!p) {
|
|
1343
|
+
const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
|
|
1344
|
+
p = new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
1345
|
+
_providerCache.set(config, p);
|
|
1346
|
+
}
|
|
1347
|
+
return p;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1298
1350
|
// src/starknet/abis/ipMarketplace.ts
|
|
1299
1351
|
var IPMarketplaceABI = [
|
|
1300
1352
|
{
|
|
@@ -5793,12 +5845,8 @@ var IPTicketCollectionABI = [
|
|
|
5793
5845
|
},
|
|
5794
5846
|
{
|
|
5795
5847
|
"type": "struct",
|
|
5796
|
-
"name": "ip_ticket::types::
|
|
5848
|
+
"name": "ip_ticket::types::Ticket",
|
|
5797
5849
|
"members": [
|
|
5798
|
-
{
|
|
5799
|
-
"name": "creator",
|
|
5800
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
5801
|
-
},
|
|
5802
5850
|
{
|
|
5803
5851
|
"name": "max_supply",
|
|
5804
5852
|
"type": "core::integer::u256"
|
|
@@ -5822,10 +5870,6 @@ var IPTicketCollectionABI = [
|
|
|
5822
5870
|
{
|
|
5823
5871
|
"name": "metadata_uri",
|
|
5824
5872
|
"type": "core::byte_array::ByteArray"
|
|
5825
|
-
},
|
|
5826
|
-
{
|
|
5827
|
-
"name": "active",
|
|
5828
|
-
"type": "core::bool"
|
|
5829
5873
|
}
|
|
5830
5874
|
]
|
|
5831
5875
|
},
|
|
@@ -5835,7 +5879,7 @@ var IPTicketCollectionABI = [
|
|
|
5835
5879
|
"items": [
|
|
5836
5880
|
{
|
|
5837
5881
|
"type": "function",
|
|
5838
|
-
"name": "
|
|
5882
|
+
"name": "create_ticket",
|
|
5839
5883
|
"inputs": [
|
|
5840
5884
|
{
|
|
5841
5885
|
"name": "max_supply",
|
|
@@ -5887,52 +5931,69 @@ var IPTicketCollectionABI = [
|
|
|
5887
5931
|
},
|
|
5888
5932
|
{
|
|
5889
5933
|
"type": "function",
|
|
5890
|
-
"name": "
|
|
5934
|
+
"name": "is_valid",
|
|
5891
5935
|
"inputs": [
|
|
5892
5936
|
{
|
|
5893
5937
|
"name": "token_id",
|
|
5894
5938
|
"type": "core::integer::u256"
|
|
5895
5939
|
},
|
|
5896
5940
|
{
|
|
5897
|
-
"name": "
|
|
5941
|
+
"name": "holder",
|
|
5942
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
5943
|
+
}
|
|
5944
|
+
],
|
|
5945
|
+
"outputs": [
|
|
5946
|
+
{
|
|
5898
5947
|
"type": "core::bool"
|
|
5899
5948
|
}
|
|
5900
5949
|
],
|
|
5901
|
-
"
|
|
5902
|
-
"state_mutability": "external"
|
|
5950
|
+
"state_mutability": "view"
|
|
5903
5951
|
},
|
|
5904
5952
|
{
|
|
5905
5953
|
"type": "function",
|
|
5906
|
-
"name": "
|
|
5954
|
+
"name": "get_ticket",
|
|
5907
5955
|
"inputs": [
|
|
5908
5956
|
{
|
|
5909
5957
|
"name": "token_id",
|
|
5910
5958
|
"type": "core::integer::u256"
|
|
5911
|
-
}
|
|
5959
|
+
}
|
|
5960
|
+
],
|
|
5961
|
+
"outputs": [
|
|
5912
5962
|
{
|
|
5913
|
-
"
|
|
5914
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
5963
|
+
"type": "ip_ticket::types::Ticket"
|
|
5915
5964
|
}
|
|
5916
5965
|
],
|
|
5966
|
+
"state_mutability": "view"
|
|
5967
|
+
},
|
|
5968
|
+
{
|
|
5969
|
+
"type": "function",
|
|
5970
|
+
"name": "name",
|
|
5971
|
+
"inputs": [],
|
|
5917
5972
|
"outputs": [
|
|
5918
5973
|
{
|
|
5919
|
-
"type": "core::
|
|
5974
|
+
"type": "core::byte_array::ByteArray"
|
|
5920
5975
|
}
|
|
5921
5976
|
],
|
|
5922
5977
|
"state_mutability": "view"
|
|
5923
5978
|
},
|
|
5924
5979
|
{
|
|
5925
5980
|
"type": "function",
|
|
5926
|
-
"name": "
|
|
5927
|
-
"inputs": [
|
|
5981
|
+
"name": "symbol",
|
|
5982
|
+
"inputs": [],
|
|
5983
|
+
"outputs": [
|
|
5928
5984
|
{
|
|
5929
|
-
"
|
|
5930
|
-
"type": "core::integer::u256"
|
|
5985
|
+
"type": "core::byte_array::ByteArray"
|
|
5931
5986
|
}
|
|
5932
5987
|
],
|
|
5988
|
+
"state_mutability": "view"
|
|
5989
|
+
},
|
|
5990
|
+
{
|
|
5991
|
+
"type": "function",
|
|
5992
|
+
"name": "base_uri",
|
|
5993
|
+
"inputs": [],
|
|
5933
5994
|
"outputs": [
|
|
5934
5995
|
{
|
|
5935
|
-
"type": "
|
|
5996
|
+
"type": "core::byte_array::ByteArray"
|
|
5936
5997
|
}
|
|
5937
5998
|
],
|
|
5938
5999
|
"state_mutability": "view"
|
|
@@ -6405,6 +6466,10 @@ var IPTicketCollectionABI = [
|
|
|
6405
6466
|
"name": "symbol",
|
|
6406
6467
|
"type": "core::byte_array::ByteArray"
|
|
6407
6468
|
},
|
|
6469
|
+
{
|
|
6470
|
+
"name": "base_uri",
|
|
6471
|
+
"type": "core::byte_array::ByteArray"
|
|
6472
|
+
},
|
|
6408
6473
|
{
|
|
6409
6474
|
"name": "owner",
|
|
6410
6475
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
@@ -6600,7 +6665,7 @@ var IPTicketCollectionABI = [
|
|
|
6600
6665
|
},
|
|
6601
6666
|
{
|
|
6602
6667
|
"type": "event",
|
|
6603
|
-
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::
|
|
6668
|
+
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCreated",
|
|
6604
6669
|
"kind": "struct",
|
|
6605
6670
|
"members": [
|
|
6606
6671
|
{
|
|
@@ -6635,23 +6700,6 @@ var IPTicketCollectionABI = [
|
|
|
6635
6700
|
}
|
|
6636
6701
|
]
|
|
6637
6702
|
},
|
|
6638
|
-
{
|
|
6639
|
-
"type": "event",
|
|
6640
|
-
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
|
|
6641
|
-
"kind": "struct",
|
|
6642
|
-
"members": [
|
|
6643
|
-
{
|
|
6644
|
-
"name": "token_id",
|
|
6645
|
-
"type": "core::integer::u256",
|
|
6646
|
-
"kind": "key"
|
|
6647
|
-
},
|
|
6648
|
-
{
|
|
6649
|
-
"name": "active",
|
|
6650
|
-
"type": "core::bool",
|
|
6651
|
-
"kind": "data"
|
|
6652
|
-
}
|
|
6653
|
-
]
|
|
6654
|
-
},
|
|
6655
6703
|
{
|
|
6656
6704
|
"type": "event",
|
|
6657
6705
|
"name": "ip_ticket::IPTicketCollection::IPTicketCollection::Event",
|
|
@@ -6673,13 +6721,8 @@ var IPTicketCollectionABI = [
|
|
|
6673
6721
|
"kind": "flat"
|
|
6674
6722
|
},
|
|
6675
6723
|
{
|
|
6676
|
-
"name": "
|
|
6677
|
-
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::
|
|
6678
|
-
"kind": "nested"
|
|
6679
|
-
},
|
|
6680
|
-
{
|
|
6681
|
-
"name": "EventPaused",
|
|
6682
|
-
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
|
|
6724
|
+
"name": "TicketCreated",
|
|
6725
|
+
"type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCreated",
|
|
6683
6726
|
"kind": "nested"
|
|
6684
6727
|
}
|
|
6685
6728
|
]
|
|
@@ -6748,6 +6791,10 @@ var IPTicketCollectionFactoryABI = [
|
|
|
6748
6791
|
{
|
|
6749
6792
|
"name": "symbol",
|
|
6750
6793
|
"type": "core::byte_array::ByteArray"
|
|
6794
|
+
},
|
|
6795
|
+
{
|
|
6796
|
+
"name": "base_uri",
|
|
6797
|
+
"type": "core::byte_array::ByteArray"
|
|
6751
6798
|
}
|
|
6752
6799
|
],
|
|
6753
6800
|
"outputs": [
|
|
@@ -11330,7 +11377,7 @@ var PopService = class {
|
|
|
11330
11377
|
this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
|
|
11331
11378
|
}
|
|
11332
11379
|
_collection(address, account) {
|
|
11333
|
-
return
|
|
11380
|
+
return newContract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11334
11381
|
}
|
|
11335
11382
|
async claim(account, collectionAddress) {
|
|
11336
11383
|
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
@@ -11379,7 +11426,7 @@ var PopService = class {
|
|
|
11379
11426
|
return { txHash: res.transaction_hash };
|
|
11380
11427
|
}
|
|
11381
11428
|
async createCollection(account, params) {
|
|
11382
|
-
const factory =
|
|
11429
|
+
const factory = newContract(POPFactoryABI, this.factoryAddress, account);
|
|
11383
11430
|
const call = factory.populate("create_collection", [
|
|
11384
11431
|
params.name,
|
|
11385
11432
|
params.symbol,
|
|
@@ -11421,7 +11468,7 @@ var DropService = class {
|
|
|
11421
11468
|
this.config = config;
|
|
11422
11469
|
}
|
|
11423
11470
|
_collection(address, account) {
|
|
11424
|
-
return
|
|
11471
|
+
return newContract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11425
11472
|
}
|
|
11426
11473
|
async claim(account, collectionAddress, quantity = 1) {
|
|
11427
11474
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -11485,7 +11532,7 @@ var DropService = class {
|
|
|
11485
11532
|
return { txHash: res.transaction_hash };
|
|
11486
11533
|
}
|
|
11487
11534
|
async createDrop(account, params) {
|
|
11488
|
-
const factory =
|
|
11535
|
+
const factory = newContract(DropFactoryABI, this.factoryAddress, account);
|
|
11489
11536
|
const call = factory.populate("create_drop", [
|
|
11490
11537
|
params.name,
|
|
11491
11538
|
params.symbol,
|
|
@@ -11497,19 +11544,21 @@ var DropService = class {
|
|
|
11497
11544
|
return { txHash: res.transaction_hash };
|
|
11498
11545
|
}
|
|
11499
11546
|
};
|
|
11547
|
+
|
|
11548
|
+
// src/starknet/services/erc1155collection.ts
|
|
11500
11549
|
var ERC1155CollectionService = class {
|
|
11501
11550
|
constructor(config) {
|
|
11502
11551
|
this.factoryAddress = config.collection1155Contract ?? getStarknetCoordinates(config.chain).collection1155;
|
|
11503
11552
|
}
|
|
11504
11553
|
_factory(account) {
|
|
11505
|
-
return
|
|
11554
|
+
return newContract(
|
|
11506
11555
|
IPCollection1155FactoryABI,
|
|
11507
11556
|
normalizeAddress("STARKNET", this.factoryAddress),
|
|
11508
11557
|
account
|
|
11509
11558
|
);
|
|
11510
11559
|
}
|
|
11511
11560
|
_collection(address, account) {
|
|
11512
|
-
return
|
|
11561
|
+
return newContract(
|
|
11513
11562
|
IPCollection1155ABI,
|
|
11514
11563
|
normalizeAddress("STARKNET", address),
|
|
11515
11564
|
account
|
|
@@ -11654,7 +11703,7 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
11654
11703
|
var _factoryContract = null;
|
|
11655
11704
|
function factoryContract() {
|
|
11656
11705
|
if (!_factoryContract) {
|
|
11657
|
-
_factoryContract =
|
|
11706
|
+
_factoryContract = newContract(
|
|
11658
11707
|
CreatorCoinFactoryABI,
|
|
11659
11708
|
getStarknetCoordinates("STARKNET").creatorCoinFactory
|
|
11660
11709
|
);
|
|
@@ -11724,7 +11773,7 @@ var CreatorCoinService = class {
|
|
|
11724
11773
|
this.config = config;
|
|
11725
11774
|
}
|
|
11726
11775
|
_factory(account) {
|
|
11727
|
-
return
|
|
11776
|
+
return newContract(CreatorCoinFactoryABI, this.factoryAddress, account);
|
|
11728
11777
|
}
|
|
11729
11778
|
/** Deploy a fixed-supply CreatorCoin (full supply minted to the Factory). */
|
|
11730
11779
|
async createCreatorCoin(account, params) {
|
|
@@ -11759,26 +11808,34 @@ var TicketService = class {
|
|
|
11759
11808
|
_factory(account, factoryAddress) {
|
|
11760
11809
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11761
11810
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
11762
|
-
return
|
|
11811
|
+
return newContract(IPTicketCollectionFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
11763
11812
|
}
|
|
11764
11813
|
_collection(address, account) {
|
|
11765
|
-
return
|
|
11814
|
+
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11766
11815
|
}
|
|
11767
11816
|
_collectionRead(address) {
|
|
11768
11817
|
const provider = new RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11769
|
-
return
|
|
11818
|
+
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
11770
11819
|
}
|
|
11771
|
-
/**
|
|
11820
|
+
/**
|
|
11821
|
+
* Deploys a new IPTicketCollection via the factory. Caller becomes owner.
|
|
11822
|
+
* `baseUri` is the collection-level metadata URI, embedded on-chain in the
|
|
11823
|
+
* deploy transaction.
|
|
11824
|
+
*/
|
|
11772
11825
|
async deployCollection(account, params) {
|
|
11773
|
-
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11826
|
+
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11827
|
+
params.name,
|
|
11828
|
+
params.symbol,
|
|
11829
|
+
params.baseUri
|
|
11830
|
+
]);
|
|
11774
11831
|
const res = await account.execute([call]);
|
|
11775
11832
|
return { txHash: res.transaction_hash };
|
|
11776
11833
|
}
|
|
11777
|
-
/** Owner-only. Creates a new
|
|
11778
|
-
async
|
|
11834
|
+
/** Owner-only. Creates a new ticket inside the caller's deployed collection. */
|
|
11835
|
+
async createTicket(account, params) {
|
|
11779
11836
|
const startTime = params.startTime != null ? new CairoOption(CairoOptionVariant.Some, params.startTime) : new CairoOption(CairoOptionVariant.None);
|
|
11780
11837
|
const endTime = params.endTime != null ? new CairoOption(CairoOptionVariant.Some, params.endTime) : new CairoOption(CairoOptionVariant.None);
|
|
11781
|
-
const call = this._collection(params.collection, account).populate("
|
|
11838
|
+
const call = this._collection(params.collection, account).populate("create_ticket", [
|
|
11782
11839
|
cairo.uint256(params.maxSupply),
|
|
11783
11840
|
startTime,
|
|
11784
11841
|
endTime,
|
|
@@ -11798,16 +11855,7 @@ var TicketService = class {
|
|
|
11798
11855
|
const res = await account.execute([call]);
|
|
11799
11856
|
return { txHash: res.transaction_hash };
|
|
11800
11857
|
}
|
|
11801
|
-
/**
|
|
11802
|
-
async pauseEvent(account, params) {
|
|
11803
|
-
const call = this._collection(params.collection, account).populate("pause_event", [
|
|
11804
|
-
cairo.uint256(params.tokenId),
|
|
11805
|
-
params.active
|
|
11806
|
-
]);
|
|
11807
|
-
const res = await account.execute([call]);
|
|
11808
|
-
return { txHash: res.transaction_hash };
|
|
11809
|
-
}
|
|
11810
|
-
/** Read — true if holder has balance > 0 and current time is within the event window. */
|
|
11858
|
+
/** Read — true if holder has balance > 0 and current time is within the ticket window. */
|
|
11811
11859
|
async isValid(params) {
|
|
11812
11860
|
const result = await this._collectionRead(params.collection).call("is_valid", [
|
|
11813
11861
|
cairo.uint256(params.tokenId),
|
|
@@ -11815,20 +11863,18 @@ var TicketService = class {
|
|
|
11815
11863
|
]);
|
|
11816
11864
|
return Boolean(result);
|
|
11817
11865
|
}
|
|
11818
|
-
/** Read — returns the
|
|
11819
|
-
async
|
|
11820
|
-
const
|
|
11866
|
+
/** Read — returns the Ticket record for a token ID. */
|
|
11867
|
+
async getTicket(params) {
|
|
11868
|
+
const t = await this._collectionRead(params.collection).call("get_ticket", [
|
|
11821
11869
|
cairo.uint256(params.tokenId)
|
|
11822
11870
|
]);
|
|
11823
11871
|
return {
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
metadataUri: ev.metadata_uri,
|
|
11831
|
-
active: Boolean(ev.active)
|
|
11872
|
+
maxSupply: BigInt(t.max_supply),
|
|
11873
|
+
minted: BigInt(t.minted),
|
|
11874
|
+
startTime: t.start_time?.variant === "Some" ? Number(t.start_time.values[0] ?? t.start_time.value) : null,
|
|
11875
|
+
endTime: t.end_time?.variant === "Some" ? Number(t.end_time.values[0] ?? t.end_time.value) : null,
|
|
11876
|
+
royaltyBps: Number(t.royalty_bps),
|
|
11877
|
+
metadataUri: t.metadata_uri
|
|
11832
11878
|
};
|
|
11833
11879
|
}
|
|
11834
11880
|
};
|
|
@@ -11841,15 +11887,15 @@ var ClubService = class {
|
|
|
11841
11887
|
_registry(account, registryAddress) {
|
|
11842
11888
|
const address = registryAddress ?? this.registryAddress;
|
|
11843
11889
|
if (!address) throw new Error("IP-Club registry address not configured for this chain");
|
|
11844
|
-
return
|
|
11890
|
+
return newContract(IPClubABI, normalizeAddress("STARKNET", address), account);
|
|
11845
11891
|
}
|
|
11846
11892
|
_factory(account, factoryAddress) {
|
|
11847
11893
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11848
11894
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11849
|
-
return
|
|
11895
|
+
return newContract(IPClubFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
11850
11896
|
}
|
|
11851
11897
|
_collection(account, collectionAddress) {
|
|
11852
|
-
return
|
|
11898
|
+
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", collectionAddress), account);
|
|
11853
11899
|
}
|
|
11854
11900
|
/** Deploy a new per-creator membership ERC-721 collection via the factory. */
|
|
11855
11901
|
async deployClub(account, params) {
|
|
@@ -11961,7 +12007,7 @@ var SponsorshipService = class {
|
|
|
11961
12007
|
if (!resolved) {
|
|
11962
12008
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11963
12009
|
}
|
|
11964
|
-
return
|
|
12010
|
+
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), account);
|
|
11965
12011
|
}
|
|
11966
12012
|
/** The offer author must currently own (nftContract, tokenId) — enforced on-chain at create and accept. */
|
|
11967
12013
|
async createOffer(account, params) {
|
|
@@ -12030,7 +12076,7 @@ var SponsorshipService = class {
|
|
|
12030
12076
|
cairo.uint256(params.offerId),
|
|
12031
12077
|
params.sponsor
|
|
12032
12078
|
]);
|
|
12033
|
-
const receipt =
|
|
12079
|
+
const receipt = newContract(IPGenesisABI, normalizeAddress("STARKNET", receiptAddress), account);
|
|
12034
12080
|
const mintCall = receipt.populate("mint_item", [params.sponsor, params.licenseTermsUri]);
|
|
12035
12081
|
const res = await account.execute([acceptCall, mintCall]);
|
|
12036
12082
|
return { txHash: res.transaction_hash };
|
|
@@ -12050,7 +12096,7 @@ var SponsorshipService = class {
|
|
|
12050
12096
|
];
|
|
12051
12097
|
const receiptAddress = params.licenseReceiptAddress ?? this.licenseReceiptAddress;
|
|
12052
12098
|
if (receiptAddress && params.receiptTokenId != null) {
|
|
12053
|
-
const receipt =
|
|
12099
|
+
const receipt = newContract(IPGenesisABI, normalizeAddress("STARKNET", receiptAddress), account);
|
|
12054
12100
|
calls.push(receipt.populate("transfer_from", [account.address, params.to, cairo.uint256(params.receiptTokenId)]));
|
|
12055
12101
|
}
|
|
12056
12102
|
const res = await account.execute(calls);
|
|
@@ -12105,48 +12151,6 @@ var MedialaneClient = class {
|
|
|
12105
12151
|
}
|
|
12106
12152
|
};
|
|
12107
12153
|
|
|
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
12154
|
// src/starknet/marketplace/orders.ts
|
|
12151
12155
|
var _contractCache = /* @__PURE__ */ new WeakMap();
|
|
12152
12156
|
function makeContract(config) {
|