@medialane/sdk 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -21
- package/dist/index.cjs +26 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,22 +7,27 @@ declare const SUPPORTED_TOKENS: readonly [{
|
|
|
7
7
|
readonly symbol: "USDC";
|
|
8
8
|
readonly address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb";
|
|
9
9
|
readonly decimals: 6;
|
|
10
|
-
|
|
11
|
-
readonly symbol: "USDC.e";
|
|
12
|
-
readonly address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8";
|
|
13
|
-
readonly decimals: 6;
|
|
10
|
+
readonly listable: true;
|
|
14
11
|
}, {
|
|
15
12
|
readonly symbol: "USDT";
|
|
16
13
|
readonly address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8";
|
|
17
14
|
readonly decimals: 6;
|
|
15
|
+
readonly listable: true;
|
|
18
16
|
}, {
|
|
19
17
|
readonly symbol: "ETH";
|
|
20
18
|
readonly address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";
|
|
21
19
|
readonly decimals: 18;
|
|
20
|
+
readonly listable: true;
|
|
22
21
|
}, {
|
|
23
22
|
readonly symbol: "STRK";
|
|
24
23
|
readonly address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d";
|
|
25
24
|
readonly decimals: 18;
|
|
25
|
+
readonly listable: true;
|
|
26
|
+
}, {
|
|
27
|
+
readonly symbol: "WBTC";
|
|
28
|
+
readonly address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac";
|
|
29
|
+
readonly decimals: 8;
|
|
30
|
+
readonly listable: true;
|
|
26
31
|
}];
|
|
27
32
|
type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number]["symbol"];
|
|
28
33
|
declare const SUPPORTED_NETWORKS: readonly ["mainnet", "sepolia"];
|
|
@@ -552,6 +557,7 @@ interface ApiCollectionProfile {
|
|
|
552
557
|
interface ApiCreatorProfile {
|
|
553
558
|
walletAddress: string;
|
|
554
559
|
chain: string;
|
|
560
|
+
username: string | null;
|
|
555
561
|
displayName: string | null;
|
|
556
562
|
bio: string | null;
|
|
557
563
|
avatarImage: string | null;
|
|
@@ -663,6 +669,8 @@ declare class ApiClient {
|
|
|
663
669
|
*/
|
|
664
670
|
updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
|
|
665
671
|
getCreatorProfile(walletAddress: string): Promise<ApiCreatorProfile | null>;
|
|
672
|
+
/** Resolve a username slug to a creator profile (public). */
|
|
673
|
+
getCreatorByUsername(username: string): Promise<ApiCreatorProfile | null>;
|
|
666
674
|
/**
|
|
667
675
|
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
668
676
|
*/
|
|
@@ -1083,6 +1091,11 @@ declare function getTokenByAddress(address: string): SupportedToken | undefined;
|
|
|
1083
1091
|
* Find a supported token by its symbol (case-insensitive).
|
|
1084
1092
|
*/
|
|
1085
1093
|
declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
|
|
1094
|
+
/**
|
|
1095
|
+
* Return all tokens available for use in listing and offer dialogs.
|
|
1096
|
+
* Tokens with listable: false appear only as marketplace filter chips.
|
|
1097
|
+
*/
|
|
1098
|
+
declare function getListableTokens(): ReadonlyArray<SupportedToken>;
|
|
1086
1099
|
|
|
1087
1100
|
/**
|
|
1088
1101
|
* Recursively convert all BigInt values to their decimal string representations.
|
|
@@ -1109,4 +1122,4 @@ declare function buildFulfillmentTypedData(message: Record<string, unknown>, cha
|
|
|
1109
1122
|
*/
|
|
1110
1123
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
|
|
1111
1124
|
|
|
1112
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionsQuery, 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 ApiResponse, type ApiSearchCollectionResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenMetadata, type ApiUsageDay, type ApiWebhookCreated, type ApiWebhookEndpoint, COLLECTION_CONTRACT_MAINNET, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type CollectionSort, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreateWebhookParams, DEFAULT_RPC_URLS, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, IPMarketplaceABI, 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, type OfferItem, type Order, type OrderParameters, type OrderStatus, type ResolvedConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type SortOrder, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1125
|
+
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionsQuery, 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 ApiResponse, type ApiSearchCollectionResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenMetadata, type ApiUsageDay, type ApiWebhookCreated, type ApiWebhookEndpoint, COLLECTION_CONTRACT_MAINNET, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type CollectionSort, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreateWebhookParams, DEFAULT_RPC_URLS, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, IPMarketplaceABI, 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, type OfferItem, type Order, type OrderParameters, type OrderStatus, 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
|
@@ -10,31 +10,35 @@ var MARKETPLACE_CONTRACT_SEPOLIA = "";
|
|
|
10
10
|
var COLLECTION_CONTRACT_SEPOLIA = "";
|
|
11
11
|
var SUPPORTED_TOKENS = [
|
|
12
12
|
{
|
|
13
|
-
// Circle-native USDC on Starknet (canonical
|
|
13
|
+
// Circle-native USDC on Starknet (canonical)
|
|
14
14
|
symbol: "USDC",
|
|
15
15
|
address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
|
|
16
|
-
decimals: 6
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
// Bridged USDC.e (Ethereum USDC bridged via Starkgate)
|
|
20
|
-
symbol: "USDC.e",
|
|
21
|
-
address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
|
|
22
|
-
decimals: 6
|
|
16
|
+
decimals: 6,
|
|
17
|
+
listable: true
|
|
23
18
|
},
|
|
24
19
|
{
|
|
25
20
|
symbol: "USDT",
|
|
26
21
|
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
27
|
-
decimals: 6
|
|
22
|
+
decimals: 6,
|
|
23
|
+
listable: true
|
|
28
24
|
},
|
|
29
25
|
{
|
|
30
26
|
symbol: "ETH",
|
|
31
27
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
32
|
-
decimals: 18
|
|
28
|
+
decimals: 18,
|
|
29
|
+
listable: true
|
|
33
30
|
},
|
|
34
31
|
{
|
|
35
32
|
symbol: "STRK",
|
|
36
33
|
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
37
|
-
decimals: 18
|
|
34
|
+
decimals: 18,
|
|
35
|
+
listable: true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
symbol: "WBTC",
|
|
39
|
+
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
40
|
+
decimals: 8,
|
|
41
|
+
listable: true
|
|
38
42
|
}
|
|
39
43
|
];
|
|
40
44
|
var DEFAULT_CURRENCY = "USDC";
|
|
@@ -396,6 +400,9 @@ function getTokenBySymbol(symbol) {
|
|
|
396
400
|
const upper = symbol.toUpperCase();
|
|
397
401
|
return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
|
|
398
402
|
}
|
|
403
|
+
function getListableTokens() {
|
|
404
|
+
return SUPPORTED_TOKENS.filter((t) => t.listable);
|
|
405
|
+
}
|
|
399
406
|
function buildOrderTypedData(message, chainId) {
|
|
400
407
|
return {
|
|
401
408
|
domain: {
|
|
@@ -1231,6 +1238,13 @@ var ApiClient = class {
|
|
|
1231
1238
|
if (res.status === 404) return null;
|
|
1232
1239
|
return res.json();
|
|
1233
1240
|
}
|
|
1241
|
+
/** Resolve a username slug to a creator profile (public). */
|
|
1242
|
+
async getCreatorByUsername(username) {
|
|
1243
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/by-username/${encodeURIComponent(username.toLowerCase().trim())}`;
|
|
1244
|
+
const res = await fetch(url, { headers: this.baseHeaders });
|
|
1245
|
+
if (res.status === 404) return null;
|
|
1246
|
+
return res.json();
|
|
1247
|
+
}
|
|
1234
1248
|
/**
|
|
1235
1249
|
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
1236
1250
|
*/
|
|
@@ -1279,6 +1293,6 @@ var MedialaneClient = class {
|
|
|
1279
1293
|
}
|
|
1280
1294
|
};
|
|
1281
1295
|
|
|
1282
|
-
export { ApiClient, COLLECTION_CONTRACT_MAINNET, DEFAULT_RPC_URLS, IPMarketplaceABI, MARKETPLACE_CONTRACT_MAINNET, MarketplaceModule, MedialaneApiError, MedialaneClient, MedialaneError, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1296
|
+
export { ApiClient, COLLECTION_CONTRACT_MAINNET, DEFAULT_RPC_URLS, IPMarketplaceABI, MARKETPLACE_CONTRACT_MAINNET, MarketplaceModule, MedialaneApiError, MedialaneClient, MedialaneError, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
1283
1297
|
//# sourceMappingURL=index.js.map
|
|
1284
1298
|
//# sourceMappingURL=index.js.map
|