@medialane/sdk 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +248 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +268 -3
- package/dist/index.d.ts +268 -3
- package/dist/index.js +245 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number]["symbol"];
|
|
|
33
33
|
declare const SUPPORTED_NETWORKS: readonly ["mainnet", "sepolia"];
|
|
34
34
|
type Network = (typeof SUPPORTED_NETWORKS)[number];
|
|
35
35
|
declare const DEFAULT_RPC_URLS: Record<Network, string>;
|
|
36
|
+
declare const POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
37
|
+
declare const POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
|
|
36
38
|
|
|
37
39
|
interface RetryOptions {
|
|
38
40
|
maxAttempts?: number;
|
|
@@ -205,12 +207,14 @@ declare class MarketplaceModule {
|
|
|
205
207
|
|
|
206
208
|
type IPType = "Audio" | "Art" | "Documents" | "NFT" | "Video" | "Photography" | "Patents" | "Posts" | "Publications" | "RWA" | "Software" | "Custom";
|
|
207
209
|
type CollectionSort = "recent" | "supply" | "floor" | "volume" | "name";
|
|
210
|
+
type CollectionSource = "MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME" | "POP_PROTOCOL";
|
|
208
211
|
interface ApiCollectionsQuery {
|
|
209
212
|
page?: number;
|
|
210
213
|
limit?: number;
|
|
211
214
|
isKnown?: boolean;
|
|
212
215
|
sort?: CollectionSort;
|
|
213
216
|
owner?: string;
|
|
217
|
+
source?: CollectionSource;
|
|
214
218
|
}
|
|
215
219
|
type OrderStatus = "ACTIVE" | "FULFILLED" | "CANCELLED" | "EXPIRED" | "COUNTER_OFFERED";
|
|
216
220
|
type SortOrder = "price_asc" | "price_desc" | "recent";
|
|
@@ -371,7 +375,7 @@ interface ApiCollection {
|
|
|
371
375
|
startBlock: string;
|
|
372
376
|
metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
|
|
373
377
|
isKnown: boolean;
|
|
374
|
-
source: "MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME";
|
|
378
|
+
source: "MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME" | "POP_PROTOCOL";
|
|
375
379
|
claimedBy: string | null;
|
|
376
380
|
profile?: ApiCollectionProfile | null;
|
|
377
381
|
floorPrice: string | null;
|
|
@@ -683,6 +687,7 @@ interface ApiCollectionProfile {
|
|
|
683
687
|
discordUrl: string | null;
|
|
684
688
|
telegramUrl: string | null;
|
|
685
689
|
hasGatedContent: boolean;
|
|
690
|
+
gatedContentTitle: string | null;
|
|
686
691
|
updatedBy: string | null;
|
|
687
692
|
updatedAt: string;
|
|
688
693
|
}
|
|
@@ -726,6 +731,15 @@ interface ApiAdminCollectionClaim extends ApiCollectionClaim {
|
|
|
726
731
|
reviewedAt: string | null;
|
|
727
732
|
updatedAt: string;
|
|
728
733
|
}
|
|
734
|
+
interface PopClaimStatus {
|
|
735
|
+
isEligible: boolean;
|
|
736
|
+
hasClaimed: boolean;
|
|
737
|
+
tokenId: string | null;
|
|
738
|
+
}
|
|
739
|
+
interface PopBatchEligibilityItem extends PopClaimStatus {
|
|
740
|
+
wallet: string;
|
|
741
|
+
}
|
|
742
|
+
type PopEventType = "Conference" | "Bootcamp" | "Workshop" | "Hackathon" | "Meetup" | "Course" | "Other";
|
|
729
743
|
|
|
730
744
|
declare class MedialaneApiError extends Error {
|
|
731
745
|
readonly status: number;
|
|
@@ -749,7 +763,7 @@ declare class ApiClient {
|
|
|
749
763
|
getToken(contract: string, tokenId: string, wait?: boolean): Promise<ApiResponse<ApiToken>>;
|
|
750
764
|
getTokensByOwner(address: string, page?: number, limit?: number): Promise<ApiResponse<ApiToken[]>>;
|
|
751
765
|
getTokenHistory(contract: string, tokenId: string, page?: number, limit?: number): Promise<ApiResponse<ApiActivity[]>>;
|
|
752
|
-
getCollections(page?: number, limit?: number, isKnown?: boolean, sort?: CollectionSort): Promise<ApiResponse<ApiCollection[]>>;
|
|
766
|
+
getCollections(page?: number, limit?: number, isKnown?: boolean, sort?: CollectionSort, source?: CollectionSource): Promise<ApiResponse<ApiCollection[]>>;
|
|
753
767
|
getCollectionsByOwner(owner: string, page?: number, limit?: number): Promise<ApiResponse<ApiCollection[]>>;
|
|
754
768
|
getCollection(contract: string): Promise<ApiResponse<ApiCollection>>;
|
|
755
769
|
getCollectionTokens(contract: string, page?: number, limit?: number): Promise<ApiResponse<ApiToken[]>>;
|
|
@@ -825,6 +839,11 @@ declare class ApiClient {
|
|
|
825
839
|
* Update collection profile. Requires Clerk JWT for ownership check.
|
|
826
840
|
*/
|
|
827
841
|
updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
|
|
842
|
+
getGatedContent(contractAddress: string, clerkToken: string): Promise<{
|
|
843
|
+
title: string;
|
|
844
|
+
url: string;
|
|
845
|
+
type: string;
|
|
846
|
+
} | null>;
|
|
828
847
|
/** List all creators with an approved username. */
|
|
829
848
|
getCreators(opts?: {
|
|
830
849
|
search?: string;
|
|
@@ -892,6 +911,53 @@ declare class ApiClient {
|
|
|
892
911
|
* Requires Clerk JWT.
|
|
893
912
|
*/
|
|
894
913
|
extendRemixOffer(id: string, days: number, clerkToken: string): Promise<ApiResponse<ApiRemixOffer>>;
|
|
914
|
+
getPopCollections(opts?: {
|
|
915
|
+
page?: number;
|
|
916
|
+
limit?: number;
|
|
917
|
+
sort?: CollectionSort;
|
|
918
|
+
}): Promise<ApiResponse<ApiCollection[]>>;
|
|
919
|
+
getPopEligibility(collection: string, wallet: string): Promise<PopClaimStatus>;
|
|
920
|
+
getPopEligibilityBatch(collection: string, wallets: string[]): Promise<PopBatchEligibilityItem[]>;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
interface CreatePopCollectionParams {
|
|
924
|
+
name: string;
|
|
925
|
+
symbol: string;
|
|
926
|
+
baseUri: string;
|
|
927
|
+
claimEndTime: number;
|
|
928
|
+
eventType: PopEventType;
|
|
929
|
+
}
|
|
930
|
+
declare class PopService {
|
|
931
|
+
private readonly factoryAddress;
|
|
932
|
+
constructor(_config: ResolvedConfig);
|
|
933
|
+
claim(account: AccountInterface, collectionAddress: string): Promise<TxResult>;
|
|
934
|
+
adminMint(account: AccountInterface, params: {
|
|
935
|
+
collection: string;
|
|
936
|
+
recipient: string;
|
|
937
|
+
customUri?: string;
|
|
938
|
+
}): Promise<TxResult>;
|
|
939
|
+
addToAllowlist(account: AccountInterface, params: {
|
|
940
|
+
collection: string;
|
|
941
|
+
address: string;
|
|
942
|
+
}): Promise<TxResult>;
|
|
943
|
+
batchAddToAllowlist(account: AccountInterface, params: {
|
|
944
|
+
collection: string;
|
|
945
|
+
addresses: string[];
|
|
946
|
+
}): Promise<TxResult>;
|
|
947
|
+
removeFromAllowlist(account: AccountInterface, params: {
|
|
948
|
+
collection: string;
|
|
949
|
+
address: string;
|
|
950
|
+
}): Promise<TxResult>;
|
|
951
|
+
setTokenUri(account: AccountInterface, params: {
|
|
952
|
+
collection: string;
|
|
953
|
+
tokenId: string | bigint;
|
|
954
|
+
uri: string;
|
|
955
|
+
}): Promise<TxResult>;
|
|
956
|
+
setPaused(account: AccountInterface, params: {
|
|
957
|
+
collection: string;
|
|
958
|
+
paused: boolean;
|
|
959
|
+
}): Promise<TxResult>;
|
|
960
|
+
createCollection(account: AccountInterface, params: CreatePopCollectionParams): Promise<TxResult>;
|
|
895
961
|
}
|
|
896
962
|
|
|
897
963
|
declare class MedialaneClient {
|
|
@@ -902,6 +968,9 @@ declare class MedialaneClient {
|
|
|
902
968
|
* Requires `backendUrl` in config; pass `apiKey` for authenticated routes.
|
|
903
969
|
*/
|
|
904
970
|
readonly api: ApiClient;
|
|
971
|
+
readonly services: {
|
|
972
|
+
readonly pop: PopService;
|
|
973
|
+
};
|
|
905
974
|
private readonly config;
|
|
906
975
|
constructor(rawConfig?: MedialaneConfig);
|
|
907
976
|
get network(): "mainnet" | "sepolia";
|
|
@@ -1278,6 +1347,202 @@ declare const IPMarketplaceABI: readonly [{
|
|
|
1278
1347
|
readonly kind: "nested";
|
|
1279
1348
|
}];
|
|
1280
1349
|
}];
|
|
1350
|
+
declare const POPCollectionABI: readonly [{
|
|
1351
|
+
readonly type: "struct";
|
|
1352
|
+
readonly name: "core::byte_array::ByteArray";
|
|
1353
|
+
readonly members: readonly [{
|
|
1354
|
+
readonly name: "data";
|
|
1355
|
+
readonly type: "core::array::Array::<core::felt252>";
|
|
1356
|
+
}, {
|
|
1357
|
+
readonly name: "pending_word";
|
|
1358
|
+
readonly type: "core::felt252";
|
|
1359
|
+
}, {
|
|
1360
|
+
readonly name: "pending_word_len";
|
|
1361
|
+
readonly type: "core::integer::u32";
|
|
1362
|
+
}];
|
|
1363
|
+
}, {
|
|
1364
|
+
readonly type: "function";
|
|
1365
|
+
readonly name: "claim";
|
|
1366
|
+
readonly inputs: readonly [];
|
|
1367
|
+
readonly outputs: readonly [];
|
|
1368
|
+
readonly state_mutability: "external";
|
|
1369
|
+
}, {
|
|
1370
|
+
readonly type: "function";
|
|
1371
|
+
readonly name: "admin_mint";
|
|
1372
|
+
readonly inputs: readonly [{
|
|
1373
|
+
readonly name: "recipient";
|
|
1374
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1375
|
+
}, {
|
|
1376
|
+
readonly name: "custom_uri";
|
|
1377
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1378
|
+
}];
|
|
1379
|
+
readonly outputs: readonly [];
|
|
1380
|
+
readonly state_mutability: "external";
|
|
1381
|
+
}, {
|
|
1382
|
+
readonly type: "function";
|
|
1383
|
+
readonly name: "add_to_allowlist";
|
|
1384
|
+
readonly inputs: readonly [{
|
|
1385
|
+
readonly name: "address";
|
|
1386
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1387
|
+
}];
|
|
1388
|
+
readonly outputs: readonly [];
|
|
1389
|
+
readonly state_mutability: "external";
|
|
1390
|
+
}, {
|
|
1391
|
+
readonly type: "function";
|
|
1392
|
+
readonly name: "batch_add_to_allowlist";
|
|
1393
|
+
readonly inputs: readonly [{
|
|
1394
|
+
readonly name: "addresses";
|
|
1395
|
+
readonly type: "core::array::Array::<core::starknet::contract_address::ContractAddress>";
|
|
1396
|
+
}];
|
|
1397
|
+
readonly outputs: readonly [];
|
|
1398
|
+
readonly state_mutability: "external";
|
|
1399
|
+
}, {
|
|
1400
|
+
readonly type: "function";
|
|
1401
|
+
readonly name: "remove_from_allowlist";
|
|
1402
|
+
readonly inputs: readonly [{
|
|
1403
|
+
readonly name: "address";
|
|
1404
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1405
|
+
}];
|
|
1406
|
+
readonly outputs: readonly [];
|
|
1407
|
+
readonly state_mutability: "external";
|
|
1408
|
+
}, {
|
|
1409
|
+
readonly type: "function";
|
|
1410
|
+
readonly name: "set_token_uri";
|
|
1411
|
+
readonly inputs: readonly [{
|
|
1412
|
+
readonly name: "token_id";
|
|
1413
|
+
readonly type: "core::integer::u256";
|
|
1414
|
+
}, {
|
|
1415
|
+
readonly name: "uri";
|
|
1416
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1417
|
+
}];
|
|
1418
|
+
readonly outputs: readonly [];
|
|
1419
|
+
readonly state_mutability: "external";
|
|
1420
|
+
}, {
|
|
1421
|
+
readonly type: "function";
|
|
1422
|
+
readonly name: "set_paused";
|
|
1423
|
+
readonly inputs: readonly [{
|
|
1424
|
+
readonly name: "paused";
|
|
1425
|
+
readonly type: "core::bool";
|
|
1426
|
+
}];
|
|
1427
|
+
readonly outputs: readonly [];
|
|
1428
|
+
readonly state_mutability: "external";
|
|
1429
|
+
}, {
|
|
1430
|
+
readonly type: "function";
|
|
1431
|
+
readonly name: "is_eligible";
|
|
1432
|
+
readonly inputs: readonly [{
|
|
1433
|
+
readonly name: "address";
|
|
1434
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1435
|
+
}];
|
|
1436
|
+
readonly outputs: readonly [{
|
|
1437
|
+
readonly type: "core::bool";
|
|
1438
|
+
}];
|
|
1439
|
+
readonly state_mutability: "view";
|
|
1440
|
+
}, {
|
|
1441
|
+
readonly type: "function";
|
|
1442
|
+
readonly name: "has_claimed";
|
|
1443
|
+
readonly inputs: readonly [{
|
|
1444
|
+
readonly name: "address";
|
|
1445
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1446
|
+
}];
|
|
1447
|
+
readonly outputs: readonly [{
|
|
1448
|
+
readonly type: "core::bool";
|
|
1449
|
+
}];
|
|
1450
|
+
readonly state_mutability: "view";
|
|
1451
|
+
}, {
|
|
1452
|
+
readonly type: "function";
|
|
1453
|
+
readonly name: "total_minted";
|
|
1454
|
+
readonly inputs: readonly [];
|
|
1455
|
+
readonly outputs: readonly [{
|
|
1456
|
+
readonly type: "core::integer::u256";
|
|
1457
|
+
}];
|
|
1458
|
+
readonly state_mutability: "view";
|
|
1459
|
+
}];
|
|
1460
|
+
declare const POPFactoryABI: readonly [{
|
|
1461
|
+
readonly type: "struct";
|
|
1462
|
+
readonly name: "core::byte_array::ByteArray";
|
|
1463
|
+
readonly members: readonly [{
|
|
1464
|
+
readonly name: "data";
|
|
1465
|
+
readonly type: "core::array::Array::<core::felt252>";
|
|
1466
|
+
}, {
|
|
1467
|
+
readonly name: "pending_word";
|
|
1468
|
+
readonly type: "core::felt252";
|
|
1469
|
+
}, {
|
|
1470
|
+
readonly name: "pending_word_len";
|
|
1471
|
+
readonly type: "core::integer::u32";
|
|
1472
|
+
}];
|
|
1473
|
+
}, {
|
|
1474
|
+
readonly type: "enum";
|
|
1475
|
+
readonly name: "pop_protocol::types::EventType";
|
|
1476
|
+
readonly variants: readonly [{
|
|
1477
|
+
readonly name: "Conference";
|
|
1478
|
+
readonly type: "()";
|
|
1479
|
+
}, {
|
|
1480
|
+
readonly name: "Bootcamp";
|
|
1481
|
+
readonly type: "()";
|
|
1482
|
+
}, {
|
|
1483
|
+
readonly name: "Workshop";
|
|
1484
|
+
readonly type: "()";
|
|
1485
|
+
}, {
|
|
1486
|
+
readonly name: "Hackathon";
|
|
1487
|
+
readonly type: "()";
|
|
1488
|
+
}, {
|
|
1489
|
+
readonly name: "Meetup";
|
|
1490
|
+
readonly type: "()";
|
|
1491
|
+
}, {
|
|
1492
|
+
readonly name: "Course";
|
|
1493
|
+
readonly type: "()";
|
|
1494
|
+
}, {
|
|
1495
|
+
readonly name: "Other";
|
|
1496
|
+
readonly type: "()";
|
|
1497
|
+
}];
|
|
1498
|
+
}, {
|
|
1499
|
+
readonly type: "function";
|
|
1500
|
+
readonly name: "create_collection";
|
|
1501
|
+
readonly inputs: readonly [{
|
|
1502
|
+
readonly name: "name";
|
|
1503
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1504
|
+
}, {
|
|
1505
|
+
readonly name: "symbol";
|
|
1506
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1507
|
+
}, {
|
|
1508
|
+
readonly name: "base_uri";
|
|
1509
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1510
|
+
}, {
|
|
1511
|
+
readonly name: "claim_end_time";
|
|
1512
|
+
readonly type: "core::integer::u64";
|
|
1513
|
+
}, {
|
|
1514
|
+
readonly name: "event_type";
|
|
1515
|
+
readonly type: "pop_protocol::types::EventType";
|
|
1516
|
+
}];
|
|
1517
|
+
readonly outputs: readonly [{
|
|
1518
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1519
|
+
}];
|
|
1520
|
+
readonly state_mutability: "external";
|
|
1521
|
+
}, {
|
|
1522
|
+
readonly type: "function";
|
|
1523
|
+
readonly name: "register_provider";
|
|
1524
|
+
readonly inputs: readonly [{
|
|
1525
|
+
readonly name: "provider";
|
|
1526
|
+
readonly type: "core::starknet::contract_address::ContractAddress";
|
|
1527
|
+
}, {
|
|
1528
|
+
readonly name: "name";
|
|
1529
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1530
|
+
}, {
|
|
1531
|
+
readonly name: "website_url";
|
|
1532
|
+
readonly type: "core::byte_array::ByteArray";
|
|
1533
|
+
}];
|
|
1534
|
+
readonly outputs: readonly [];
|
|
1535
|
+
readonly state_mutability: "external";
|
|
1536
|
+
}, {
|
|
1537
|
+
readonly type: "function";
|
|
1538
|
+
readonly name: "set_pop_collection_class_hash";
|
|
1539
|
+
readonly inputs: readonly [{
|
|
1540
|
+
readonly name: "new_class_hash";
|
|
1541
|
+
readonly type: "core::starknet::class_hash::ClassHash";
|
|
1542
|
+
}];
|
|
1543
|
+
readonly outputs: readonly [];
|
|
1544
|
+
readonly state_mutability: "external";
|
|
1545
|
+
}];
|
|
1281
1546
|
|
|
1282
1547
|
/**
|
|
1283
1548
|
* Normalize a Starknet address to a 0x-prefixed 64-character hex string.
|
|
@@ -1339,4 +1604,4 @@ declare function buildFulfillmentTypedData(message: Record<string, unknown>, cha
|
|
|
1339
1604
|
*/
|
|
1340
1605
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
|
|
1341
1606
|
|
|
1342
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, COLLECTION_CONTRACT_MAINNET, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type CollectionSort, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URLS, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, IPMarketplaceABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_CONTRACT_MAINNET, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintParams, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderParameters, type OrderStatus, type RemixOfferStatus, type ResolvedConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1607
|
+
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, COLLECTION_CONTRACT_MAINNET, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type CollectionSort, type CollectionSource, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreatePopCollectionParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URLS, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, IPMarketplaceABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_CONTRACT_MAINNET, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintParams, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderParameters, type OrderStatus, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { TypedDataRevision, shortString, cairo,
|
|
2
|
+
import { TypedDataRevision, Contract, shortString, cairo, constants, RpcProvider, byteArray, num } from 'starknet';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
5
5
|
|
|
@@ -47,6 +47,8 @@ var DEFAULT_RPC_URLS = {
|
|
|
47
47
|
mainnet: "https://rpc.starknet.lava.build",
|
|
48
48
|
sepolia: "https://rpc.starknet-sepolia.lava.build"
|
|
49
49
|
};
|
|
50
|
+
var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
51
|
+
var POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
|
|
50
52
|
|
|
51
53
|
// src/abis.ts
|
|
52
54
|
var IPMarketplaceABI = [
|
|
@@ -355,6 +357,148 @@ var IPMarketplaceABI = [
|
|
|
355
357
|
]
|
|
356
358
|
}
|
|
357
359
|
];
|
|
360
|
+
var POPCollectionABI = [
|
|
361
|
+
{
|
|
362
|
+
type: "struct",
|
|
363
|
+
name: "core::byte_array::ByteArray",
|
|
364
|
+
members: [
|
|
365
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
366
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
367
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
368
|
+
]
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
type: "function",
|
|
372
|
+
name: "claim",
|
|
373
|
+
inputs: [],
|
|
374
|
+
outputs: [],
|
|
375
|
+
state_mutability: "external"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
type: "function",
|
|
379
|
+
name: "admin_mint",
|
|
380
|
+
inputs: [
|
|
381
|
+
{ name: "recipient", type: "core::starknet::contract_address::ContractAddress" },
|
|
382
|
+
{ name: "custom_uri", type: "core::byte_array::ByteArray" }
|
|
383
|
+
],
|
|
384
|
+
outputs: [],
|
|
385
|
+
state_mutability: "external"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
type: "function",
|
|
389
|
+
name: "add_to_allowlist",
|
|
390
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
391
|
+
outputs: [],
|
|
392
|
+
state_mutability: "external"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
type: "function",
|
|
396
|
+
name: "batch_add_to_allowlist",
|
|
397
|
+
inputs: [{ name: "addresses", type: "core::array::Array::<core::starknet::contract_address::ContractAddress>" }],
|
|
398
|
+
outputs: [],
|
|
399
|
+
state_mutability: "external"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
type: "function",
|
|
403
|
+
name: "remove_from_allowlist",
|
|
404
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
405
|
+
outputs: [],
|
|
406
|
+
state_mutability: "external"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
type: "function",
|
|
410
|
+
name: "set_token_uri",
|
|
411
|
+
inputs: [
|
|
412
|
+
{ name: "token_id", type: "core::integer::u256" },
|
|
413
|
+
{ name: "uri", type: "core::byte_array::ByteArray" }
|
|
414
|
+
],
|
|
415
|
+
outputs: [],
|
|
416
|
+
state_mutability: "external"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
type: "function",
|
|
420
|
+
name: "set_paused",
|
|
421
|
+
inputs: [{ name: "paused", type: "core::bool" }],
|
|
422
|
+
outputs: [],
|
|
423
|
+
state_mutability: "external"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
type: "function",
|
|
427
|
+
name: "is_eligible",
|
|
428
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
429
|
+
outputs: [{ type: "core::bool" }],
|
|
430
|
+
state_mutability: "view"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
type: "function",
|
|
434
|
+
name: "has_claimed",
|
|
435
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
436
|
+
outputs: [{ type: "core::bool" }],
|
|
437
|
+
state_mutability: "view"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
type: "function",
|
|
441
|
+
name: "total_minted",
|
|
442
|
+
inputs: [],
|
|
443
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
444
|
+
state_mutability: "view"
|
|
445
|
+
}
|
|
446
|
+
];
|
|
447
|
+
var POPFactoryABI = [
|
|
448
|
+
{
|
|
449
|
+
type: "struct",
|
|
450
|
+
name: "core::byte_array::ByteArray",
|
|
451
|
+
members: [
|
|
452
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
453
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
454
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
455
|
+
]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
type: "enum",
|
|
459
|
+
name: "pop_protocol::types::EventType",
|
|
460
|
+
variants: [
|
|
461
|
+
{ name: "Conference", type: "()" },
|
|
462
|
+
{ name: "Bootcamp", type: "()" },
|
|
463
|
+
{ name: "Workshop", type: "()" },
|
|
464
|
+
{ name: "Hackathon", type: "()" },
|
|
465
|
+
{ name: "Meetup", type: "()" },
|
|
466
|
+
{ name: "Course", type: "()" },
|
|
467
|
+
{ name: "Other", type: "()" }
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
type: "function",
|
|
472
|
+
name: "create_collection",
|
|
473
|
+
inputs: [
|
|
474
|
+
{ name: "name", type: "core::byte_array::ByteArray" },
|
|
475
|
+
{ name: "symbol", type: "core::byte_array::ByteArray" },
|
|
476
|
+
{ name: "base_uri", type: "core::byte_array::ByteArray" },
|
|
477
|
+
{ name: "claim_end_time", type: "core::integer::u64" },
|
|
478
|
+
{ name: "event_type", type: "pop_protocol::types::EventType" }
|
|
479
|
+
],
|
|
480
|
+
outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
|
|
481
|
+
state_mutability: "external"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
type: "function",
|
|
485
|
+
name: "register_provider",
|
|
486
|
+
inputs: [
|
|
487
|
+
{ name: "provider", type: "core::starknet::contract_address::ContractAddress" },
|
|
488
|
+
{ name: "name", type: "core::byte_array::ByteArray" },
|
|
489
|
+
{ name: "website_url", type: "core::byte_array::ByteArray" }
|
|
490
|
+
],
|
|
491
|
+
outputs: [],
|
|
492
|
+
state_mutability: "external"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
type: "function",
|
|
496
|
+
name: "set_pop_collection_class_hash",
|
|
497
|
+
inputs: [{ name: "new_class_hash", type: "core::starknet::class_hash::ClassHash" }],
|
|
498
|
+
outputs: [],
|
|
499
|
+
state_mutability: "external"
|
|
500
|
+
}
|
|
501
|
+
];
|
|
358
502
|
|
|
359
503
|
// src/utils/bigint.ts
|
|
360
504
|
function stringifyBigInts(obj) {
|
|
@@ -1071,10 +1215,11 @@ var ApiClient = class {
|
|
|
1071
1215
|
);
|
|
1072
1216
|
}
|
|
1073
1217
|
// ─── Collections ───────────────────────────────────────────────────────────
|
|
1074
|
-
getCollections(page = 1, limit = 20, isKnown, sort) {
|
|
1218
|
+
getCollections(page = 1, limit = 20, isKnown, sort, source) {
|
|
1075
1219
|
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
|
|
1076
1220
|
if (isKnown !== void 0) params.set("isKnown", String(isKnown));
|
|
1077
1221
|
if (sort) params.set("sort", sort);
|
|
1222
|
+
if (source) params.set("source", source);
|
|
1078
1223
|
return this.get(`/v1/collections?${params}`);
|
|
1079
1224
|
}
|
|
1080
1225
|
getCollectionsByOwner(owner, page = 1, limit = 50) {
|
|
@@ -1269,6 +1414,14 @@ var ApiClient = class {
|
|
|
1269
1414
|
});
|
|
1270
1415
|
return res.json();
|
|
1271
1416
|
}
|
|
1417
|
+
async getGatedContent(contractAddress, clerkToken) {
|
|
1418
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${normalizeAddress(contractAddress)}/gated-content`;
|
|
1419
|
+
const res = await fetch(url, {
|
|
1420
|
+
headers: { ...this.baseHeaders, "Authorization": `Bearer ${clerkToken}` }
|
|
1421
|
+
});
|
|
1422
|
+
if (res.status === 403 || res.status === 404) return null;
|
|
1423
|
+
return res.json();
|
|
1424
|
+
}
|
|
1272
1425
|
// ─── Creator Profiles ───────────────────────────────────────────────────────
|
|
1273
1426
|
/** List all creators with an approved username. */
|
|
1274
1427
|
async getCreators(opts = {}) {
|
|
@@ -1438,6 +1591,92 @@ var ApiClient = class {
|
|
|
1438
1591
|
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1439
1592
|
});
|
|
1440
1593
|
}
|
|
1594
|
+
// ─── POP Protocol ──────────────────────────────────────────────────────────
|
|
1595
|
+
getPopCollections(opts = {}) {
|
|
1596
|
+
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "POP_PROTOCOL");
|
|
1597
|
+
}
|
|
1598
|
+
async getPopEligibility(collection, wallet) {
|
|
1599
|
+
const res = await this.get(
|
|
1600
|
+
`/v1/pop/eligibility/${normalizeAddress(collection)}/${normalizeAddress(wallet)}`
|
|
1601
|
+
);
|
|
1602
|
+
return res.data;
|
|
1603
|
+
}
|
|
1604
|
+
async getPopEligibilityBatch(collection, wallets) {
|
|
1605
|
+
const params = new URLSearchParams({ wallets: wallets.map(normalizeAddress).join(",") });
|
|
1606
|
+
const res = await this.get(
|
|
1607
|
+
`/v1/pop/eligibility/${normalizeAddress(collection)}?${params}`
|
|
1608
|
+
);
|
|
1609
|
+
return res.data;
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
var POP_FACTORY_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
1613
|
+
var PopService = class {
|
|
1614
|
+
constructor(_config) {
|
|
1615
|
+
this.factoryAddress = POP_FACTORY_MAINNET;
|
|
1616
|
+
}
|
|
1617
|
+
async claim(account, collectionAddress) {
|
|
1618
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(collectionAddress), account);
|
|
1619
|
+
const call = collection.populate("claim", []);
|
|
1620
|
+
const res = await account.execute([call]);
|
|
1621
|
+
return { txHash: res.transaction_hash };
|
|
1622
|
+
}
|
|
1623
|
+
async adminMint(account, params) {
|
|
1624
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1625
|
+
const call = collection.populate("admin_mint", [
|
|
1626
|
+
params.recipient,
|
|
1627
|
+
params.customUri ?? ""
|
|
1628
|
+
]);
|
|
1629
|
+
const res = await account.execute([call]);
|
|
1630
|
+
return { txHash: res.transaction_hash };
|
|
1631
|
+
}
|
|
1632
|
+
async addToAllowlist(account, params) {
|
|
1633
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1634
|
+
const call = collection.populate("add_to_allowlist", [params.address]);
|
|
1635
|
+
const res = await account.execute([call]);
|
|
1636
|
+
return { txHash: res.transaction_hash };
|
|
1637
|
+
}
|
|
1638
|
+
async batchAddToAllowlist(account, params) {
|
|
1639
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1640
|
+
const CHUNK = 200;
|
|
1641
|
+
const calls = [];
|
|
1642
|
+
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
1643
|
+
const chunk = params.addresses.slice(i, i + CHUNK);
|
|
1644
|
+
calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
|
|
1645
|
+
}
|
|
1646
|
+
const res = await account.execute(calls);
|
|
1647
|
+
return { txHash: res.transaction_hash };
|
|
1648
|
+
}
|
|
1649
|
+
async removeFromAllowlist(account, params) {
|
|
1650
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1651
|
+
const call = collection.populate("remove_from_allowlist", [params.address]);
|
|
1652
|
+
const res = await account.execute([call]);
|
|
1653
|
+
return { txHash: res.transaction_hash };
|
|
1654
|
+
}
|
|
1655
|
+
async setTokenUri(account, params) {
|
|
1656
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1657
|
+
const call = collection.populate("set_token_uri", [BigInt(params.tokenId), params.uri]);
|
|
1658
|
+
const res = await account.execute([call]);
|
|
1659
|
+
return { txHash: res.transaction_hash };
|
|
1660
|
+
}
|
|
1661
|
+
async setPaused(account, params) {
|
|
1662
|
+
const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
|
|
1663
|
+
const call = collection.populate("set_paused", [params.paused]);
|
|
1664
|
+
const res = await account.execute([call]);
|
|
1665
|
+
return { txHash: res.transaction_hash };
|
|
1666
|
+
}
|
|
1667
|
+
async createCollection(account, params) {
|
|
1668
|
+
const factory = new Contract(POPFactoryABI, this.factoryAddress, account);
|
|
1669
|
+
const eventTypeVariant = { [params.eventType]: {} };
|
|
1670
|
+
const call = factory.populate("create_collection", [
|
|
1671
|
+
params.name,
|
|
1672
|
+
params.symbol,
|
|
1673
|
+
params.baseUri,
|
|
1674
|
+
params.claimEndTime,
|
|
1675
|
+
eventTypeVariant
|
|
1676
|
+
]);
|
|
1677
|
+
const res = await account.execute([call]);
|
|
1678
|
+
return { txHash: res.transaction_hash };
|
|
1679
|
+
}
|
|
1441
1680
|
};
|
|
1442
1681
|
|
|
1443
1682
|
// src/client.ts
|
|
@@ -1445,6 +1684,9 @@ var MedialaneClient = class {
|
|
|
1445
1684
|
constructor(rawConfig = {}) {
|
|
1446
1685
|
this.config = resolveConfig(rawConfig);
|
|
1447
1686
|
this.marketplace = new MarketplaceModule(this.config);
|
|
1687
|
+
this.services = {
|
|
1688
|
+
pop: new PopService(this.config)
|
|
1689
|
+
};
|
|
1448
1690
|
if (!this.config.backendUrl) {
|
|
1449
1691
|
this.api = new Proxy({}, {
|
|
1450
1692
|
get(_target, prop) {
|
|
@@ -1473,6 +1715,6 @@ var MedialaneClient = class {
|
|
|
1473
1715
|
// src/types/api.ts
|
|
1474
1716
|
var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
|
|
1475
1717
|
|
|
1476
|
-
export { ApiClient, COLLECTION_CONTRACT_MAINNET, DEFAULT_RPC_URLS, IPMarketplaceABI, MARKETPLACE_CONTRACT_MAINNET, MarketplaceModule, MedialaneApiError, MedialaneClient, MedialaneError, OPEN_LICENSES, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1718
|
+
export { ApiClient, COLLECTION_CONTRACT_MAINNET, DEFAULT_RPC_URLS, IPMarketplaceABI, MARKETPLACE_CONTRACT_MAINNET, MarketplaceModule, MedialaneApiError, MedialaneClient, MedialaneError, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1477
1719
|
//# sourceMappingURL=index.js.map
|
|
1478
1720
|
//# sourceMappingURL=index.js.map
|