@medialane/sdk 0.4.0 → 0.4.1
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 +73 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -361,6 +361,9 @@ interface ApiCollection {
|
|
|
361
361
|
startBlock: string;
|
|
362
362
|
metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
|
|
363
363
|
isKnown: boolean;
|
|
364
|
+
source: "MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME";
|
|
365
|
+
claimedBy: string | null;
|
|
366
|
+
profile?: ApiCollectionProfile | null;
|
|
364
367
|
floorPrice: string | null;
|
|
365
368
|
totalVolume: string | null;
|
|
366
369
|
holderCount: number | null;
|
|
@@ -532,6 +535,50 @@ interface CreateWebhookParams {
|
|
|
532
535
|
events: WebhookEventType[];
|
|
533
536
|
label?: string;
|
|
534
537
|
}
|
|
538
|
+
interface ApiCollectionProfile {
|
|
539
|
+
contractAddress: string;
|
|
540
|
+
chain: string;
|
|
541
|
+
displayName: string | null;
|
|
542
|
+
description: string | null;
|
|
543
|
+
image: string | null;
|
|
544
|
+
bannerImage: string | null;
|
|
545
|
+
websiteUrl: string | null;
|
|
546
|
+
twitterUrl: string | null;
|
|
547
|
+
discordUrl: string | null;
|
|
548
|
+
telegramUrl: string | null;
|
|
549
|
+
updatedBy: string | null;
|
|
550
|
+
updatedAt: string;
|
|
551
|
+
}
|
|
552
|
+
interface ApiCreatorProfile {
|
|
553
|
+
walletAddress: string;
|
|
554
|
+
chain: string;
|
|
555
|
+
displayName: string | null;
|
|
556
|
+
bio: string | null;
|
|
557
|
+
avatarImage: string | null;
|
|
558
|
+
bannerImage: string | null;
|
|
559
|
+
websiteUrl: string | null;
|
|
560
|
+
twitterUrl: string | null;
|
|
561
|
+
discordUrl: string | null;
|
|
562
|
+
telegramUrl: string | null;
|
|
563
|
+
updatedAt: string;
|
|
564
|
+
}
|
|
565
|
+
interface ApiCollectionClaim {
|
|
566
|
+
id: string;
|
|
567
|
+
contractAddress: string;
|
|
568
|
+
chain: string;
|
|
569
|
+
claimantAddress: string | null;
|
|
570
|
+
status: "PENDING" | "AUTO_APPROVED" | "APPROVED" | "REJECTED";
|
|
571
|
+
verificationMethod: "ONCHAIN" | "SIGNATURE" | "MANUAL";
|
|
572
|
+
createdAt: string;
|
|
573
|
+
}
|
|
574
|
+
interface ApiAdminCollectionClaim extends ApiCollectionClaim {
|
|
575
|
+
claimantEmail: string | null;
|
|
576
|
+
notes: string | null;
|
|
577
|
+
adminNotes: string | null;
|
|
578
|
+
reviewedBy: string | null;
|
|
579
|
+
reviewedAt: string | null;
|
|
580
|
+
updatedAt: string;
|
|
581
|
+
}
|
|
535
582
|
|
|
536
583
|
declare class MedialaneApiError extends Error {
|
|
537
584
|
readonly status: number;
|
|
@@ -590,6 +637,36 @@ declare class ApiClient {
|
|
|
590
637
|
id: string;
|
|
591
638
|
status: string;
|
|
592
639
|
}>>;
|
|
640
|
+
/**
|
|
641
|
+
* Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
|
|
642
|
+
* Authorization: Bearer (Clerk JWT) simultaneously.
|
|
643
|
+
*/
|
|
644
|
+
claimCollection(contractAddress: string, walletAddress: string, clerkToken: string): Promise<{
|
|
645
|
+
verified: boolean;
|
|
646
|
+
collection?: ApiCollection;
|
|
647
|
+
reason?: string;
|
|
648
|
+
}>;
|
|
649
|
+
/**
|
|
650
|
+
* Path 3: Manual off-chain claim request (email-based).
|
|
651
|
+
*/
|
|
652
|
+
requestCollectionClaim(params: {
|
|
653
|
+
contractAddress: string;
|
|
654
|
+
walletAddress?: string;
|
|
655
|
+
email: string;
|
|
656
|
+
notes?: string;
|
|
657
|
+
}): Promise<{
|
|
658
|
+
claim: ApiCollectionClaim;
|
|
659
|
+
}>;
|
|
660
|
+
getCollectionProfile(contractAddress: string): Promise<ApiCollectionProfile | null>;
|
|
661
|
+
/**
|
|
662
|
+
* Update collection profile. Requires Clerk JWT for ownership check.
|
|
663
|
+
*/
|
|
664
|
+
updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
|
|
665
|
+
getCreatorProfile(walletAddress: string): Promise<ApiCreatorProfile | null>;
|
|
666
|
+
/**
|
|
667
|
+
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
668
|
+
*/
|
|
669
|
+
updateCreatorProfile(walletAddress: string, data: Partial<Omit<ApiCreatorProfile, "walletAddress" | "chain" | "updatedAt">>, clerkToken: string): Promise<ApiCreatorProfile>;
|
|
593
670
|
}
|
|
594
671
|
|
|
595
672
|
declare class MedialaneClient {
|
|
@@ -1032,4 +1109,4 @@ declare function buildFulfillmentTypedData(message: Record<string, unknown>, cha
|
|
|
1032
1109
|
*/
|
|
1033
1110
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
|
|
1034
1111
|
|
|
1035
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, ApiClient, type ApiCollection, type ApiCollectionsQuery, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,9 @@ interface ApiCollection {
|
|
|
361
361
|
startBlock: string;
|
|
362
362
|
metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
|
|
363
363
|
isKnown: boolean;
|
|
364
|
+
source: "MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME";
|
|
365
|
+
claimedBy: string | null;
|
|
366
|
+
profile?: ApiCollectionProfile | null;
|
|
364
367
|
floorPrice: string | null;
|
|
365
368
|
totalVolume: string | null;
|
|
366
369
|
holderCount: number | null;
|
|
@@ -532,6 +535,50 @@ interface CreateWebhookParams {
|
|
|
532
535
|
events: WebhookEventType[];
|
|
533
536
|
label?: string;
|
|
534
537
|
}
|
|
538
|
+
interface ApiCollectionProfile {
|
|
539
|
+
contractAddress: string;
|
|
540
|
+
chain: string;
|
|
541
|
+
displayName: string | null;
|
|
542
|
+
description: string | null;
|
|
543
|
+
image: string | null;
|
|
544
|
+
bannerImage: string | null;
|
|
545
|
+
websiteUrl: string | null;
|
|
546
|
+
twitterUrl: string | null;
|
|
547
|
+
discordUrl: string | null;
|
|
548
|
+
telegramUrl: string | null;
|
|
549
|
+
updatedBy: string | null;
|
|
550
|
+
updatedAt: string;
|
|
551
|
+
}
|
|
552
|
+
interface ApiCreatorProfile {
|
|
553
|
+
walletAddress: string;
|
|
554
|
+
chain: string;
|
|
555
|
+
displayName: string | null;
|
|
556
|
+
bio: string | null;
|
|
557
|
+
avatarImage: string | null;
|
|
558
|
+
bannerImage: string | null;
|
|
559
|
+
websiteUrl: string | null;
|
|
560
|
+
twitterUrl: string | null;
|
|
561
|
+
discordUrl: string | null;
|
|
562
|
+
telegramUrl: string | null;
|
|
563
|
+
updatedAt: string;
|
|
564
|
+
}
|
|
565
|
+
interface ApiCollectionClaim {
|
|
566
|
+
id: string;
|
|
567
|
+
contractAddress: string;
|
|
568
|
+
chain: string;
|
|
569
|
+
claimantAddress: string | null;
|
|
570
|
+
status: "PENDING" | "AUTO_APPROVED" | "APPROVED" | "REJECTED";
|
|
571
|
+
verificationMethod: "ONCHAIN" | "SIGNATURE" | "MANUAL";
|
|
572
|
+
createdAt: string;
|
|
573
|
+
}
|
|
574
|
+
interface ApiAdminCollectionClaim extends ApiCollectionClaim {
|
|
575
|
+
claimantEmail: string | null;
|
|
576
|
+
notes: string | null;
|
|
577
|
+
adminNotes: string | null;
|
|
578
|
+
reviewedBy: string | null;
|
|
579
|
+
reviewedAt: string | null;
|
|
580
|
+
updatedAt: string;
|
|
581
|
+
}
|
|
535
582
|
|
|
536
583
|
declare class MedialaneApiError extends Error {
|
|
537
584
|
readonly status: number;
|
|
@@ -590,6 +637,36 @@ declare class ApiClient {
|
|
|
590
637
|
id: string;
|
|
591
638
|
status: string;
|
|
592
639
|
}>>;
|
|
640
|
+
/**
|
|
641
|
+
* Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
|
|
642
|
+
* Authorization: Bearer (Clerk JWT) simultaneously.
|
|
643
|
+
*/
|
|
644
|
+
claimCollection(contractAddress: string, walletAddress: string, clerkToken: string): Promise<{
|
|
645
|
+
verified: boolean;
|
|
646
|
+
collection?: ApiCollection;
|
|
647
|
+
reason?: string;
|
|
648
|
+
}>;
|
|
649
|
+
/**
|
|
650
|
+
* Path 3: Manual off-chain claim request (email-based).
|
|
651
|
+
*/
|
|
652
|
+
requestCollectionClaim(params: {
|
|
653
|
+
contractAddress: string;
|
|
654
|
+
walletAddress?: string;
|
|
655
|
+
email: string;
|
|
656
|
+
notes?: string;
|
|
657
|
+
}): Promise<{
|
|
658
|
+
claim: ApiCollectionClaim;
|
|
659
|
+
}>;
|
|
660
|
+
getCollectionProfile(contractAddress: string): Promise<ApiCollectionProfile | null>;
|
|
661
|
+
/**
|
|
662
|
+
* Update collection profile. Requires Clerk JWT for ownership check.
|
|
663
|
+
*/
|
|
664
|
+
updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
|
|
665
|
+
getCreatorProfile(walletAddress: string): Promise<ApiCreatorProfile | null>;
|
|
666
|
+
/**
|
|
667
|
+
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
668
|
+
*/
|
|
669
|
+
updateCreatorProfile(walletAddress: string, data: Partial<Omit<ApiCreatorProfile, "walletAddress" | "chain" | "updatedAt">>, clerkToken: string): Promise<ApiCreatorProfile>;
|
|
593
670
|
}
|
|
594
671
|
|
|
595
672
|
declare class MedialaneClient {
|
|
@@ -1032,4 +1109,4 @@ declare function buildFulfillmentTypedData(message: Record<string, unknown>, cha
|
|
|
1032
1109
|
*/
|
|
1033
1110
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
|
|
1034
1111
|
|
|
1035
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, ApiClient, type ApiCollection, type ApiCollectionsQuery, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1174,6 +1174,79 @@ var ApiClient = class {
|
|
|
1174
1174
|
`/v1/portal/webhooks/${id}`
|
|
1175
1175
|
);
|
|
1176
1176
|
}
|
|
1177
|
+
// ─── Collection Claims ──────────────────────────────────────────────────────
|
|
1178
|
+
/**
|
|
1179
|
+
* Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
|
|
1180
|
+
* Authorization: Bearer (Clerk JWT) simultaneously.
|
|
1181
|
+
*/
|
|
1182
|
+
async claimCollection(contractAddress, walletAddress, clerkToken) {
|
|
1183
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/claim`;
|
|
1184
|
+
const res = await fetch(url, {
|
|
1185
|
+
method: "POST",
|
|
1186
|
+
headers: {
|
|
1187
|
+
"x-api-key": this.baseHeaders["x-api-key"] ?? "",
|
|
1188
|
+
"Content-Type": "application/json",
|
|
1189
|
+
"Authorization": `Bearer ${clerkToken}`
|
|
1190
|
+
},
|
|
1191
|
+
body: JSON.stringify({ contractAddress, walletAddress })
|
|
1192
|
+
});
|
|
1193
|
+
return res.json();
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Path 3: Manual off-chain claim request (email-based).
|
|
1197
|
+
*/
|
|
1198
|
+
requestCollectionClaim(params) {
|
|
1199
|
+
return this.request("/v1/collections/claim/request", {
|
|
1200
|
+
method: "POST",
|
|
1201
|
+
body: JSON.stringify(params)
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
// ─── Collection Profiles ────────────────────────────────────────────────────
|
|
1205
|
+
async getCollectionProfile(contractAddress) {
|
|
1206
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${normalizeAddress(contractAddress)}/profile`;
|
|
1207
|
+
const res = await fetch(url, { headers: this.baseHeaders });
|
|
1208
|
+
if (res.status === 404) return null;
|
|
1209
|
+
return res.json();
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Update collection profile. Requires Clerk JWT for ownership check.
|
|
1213
|
+
*/
|
|
1214
|
+
async updateCollectionProfile(contractAddress, data, clerkToken) {
|
|
1215
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${normalizeAddress(contractAddress)}/profile`;
|
|
1216
|
+
const res = await fetch(url, {
|
|
1217
|
+
method: "PATCH",
|
|
1218
|
+
headers: {
|
|
1219
|
+
"x-api-key": this.baseHeaders["x-api-key"] ?? "",
|
|
1220
|
+
"Content-Type": "application/json",
|
|
1221
|
+
"Authorization": `Bearer ${clerkToken}`
|
|
1222
|
+
},
|
|
1223
|
+
body: JSON.stringify(data)
|
|
1224
|
+
});
|
|
1225
|
+
return res.json();
|
|
1226
|
+
}
|
|
1227
|
+
// ─── Creator Profiles ───────────────────────────────────────────────────────
|
|
1228
|
+
async getCreatorProfile(walletAddress) {
|
|
1229
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${normalizeAddress(walletAddress)}/profile`;
|
|
1230
|
+
const res = await fetch(url, { headers: this.baseHeaders });
|
|
1231
|
+
if (res.status === 404) return null;
|
|
1232
|
+
return res.json();
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
1236
|
+
*/
|
|
1237
|
+
async updateCreatorProfile(walletAddress, data, clerkToken) {
|
|
1238
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${normalizeAddress(walletAddress)}/profile`;
|
|
1239
|
+
const res = await fetch(url, {
|
|
1240
|
+
method: "PATCH",
|
|
1241
|
+
headers: {
|
|
1242
|
+
"x-api-key": this.baseHeaders["x-api-key"] ?? "",
|
|
1243
|
+
"Content-Type": "application/json",
|
|
1244
|
+
"Authorization": `Bearer ${clerkToken}`
|
|
1245
|
+
},
|
|
1246
|
+
body: JSON.stringify(data)
|
|
1247
|
+
});
|
|
1248
|
+
return res.json();
|
|
1249
|
+
}
|
|
1177
1250
|
};
|
|
1178
1251
|
|
|
1179
1252
|
// src/client.ts
|