@medialane/sdk 0.75.0 → 0.77.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.
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { C as Chain } from './types-Cdwb6lXp.js';
2
+ import { C as Chain } from './types-sIc3OCpo.js';
3
3
 
4
4
  interface RetryOptions {
5
5
  maxAttempts?: number;
@@ -884,6 +884,36 @@ interface ApiAdminCollectionClaim extends ApiCollectionClaim {
884
884
  reviewedAt: string | null;
885
885
  updatedAt: string;
886
886
  }
887
+ interface ApiBusinessProvisioning {
888
+ id: string;
889
+ accountId: string;
890
+ chain: string;
891
+ walletAddress: string;
892
+ /** Free-form (mirrors Identity.scheme) — "email" is the only scheme the backend
893
+ * delivers a claim link for on its own; any other scheme still registers, the
894
+ * business gets `claimUrl` back on the register response and delivers it itself. */
895
+ recipientScheme: string;
896
+ recipientValue: string;
897
+ interimOwnerPubkey: string;
898
+ newOwnerPubkey: string | null;
899
+ status: "DEPLOYED" | "HANDOFF" | "TRANSFERRED";
900
+ }
901
+ interface ApiWalletActivity {
902
+ id: string;
903
+ chain: string;
904
+ accountAddress: string;
905
+ type: "SEND" | "RECEIVE" | "SWAP" | "DEPLOY" | "GUARDIAN_SET" | "GUARDIAN_TRIGGER_ESCAPE" | "GUARDIAN_COMPLETE_ESCAPE" | "GUARDIAN_CANCEL_ESCAPE";
906
+ txHash: string;
907
+ blockNumber: string;
908
+ timestamp: string;
909
+ tokenAddress: string | null;
910
+ amount: string | null;
911
+ counterparty: string | null;
912
+ tokenInAddress: string | null;
913
+ amountIn: string | null;
914
+ tokenOutAddress: string | null;
915
+ amountOut: string | null;
916
+ }
887
917
  interface PopClaimStatus {
888
918
  isEligible: boolean;
889
919
  hasClaimed: boolean;
@@ -1078,11 +1108,22 @@ declare class ApiClient {
1078
1108
  }): Promise<{
1079
1109
  claim: ApiCollectionClaim;
1080
1110
  }>;
1111
+ registerBusinessProvisioning(params: {
1112
+ chain: "STARKNET";
1113
+ walletAddress: string;
1114
+ recipientScheme: string;
1115
+ recipientValue: string;
1116
+ interimOwnerPubkey: string;
1117
+ }): Promise<ApiResponse<ApiBusinessProvisioning & {
1118
+ claimUrl: string;
1119
+ }>>;
1120
+ completeBusinessProvisioning(id: string): Promise<ApiResponse<ApiBusinessProvisioning>>;
1081
1121
  getCollectionProfile(contractAddress: string): Promise<ApiCollectionProfile | null>;
1082
1122
  /**
1083
1123
  * Update collection profile. Requires Clerk JWT for ownership check.
1084
1124
  */
1085
1125
  updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
1126
+ getWalletActivity(address: string, siwsToken: string, chain?: "STARKNET"): Promise<ApiResponse<ApiWalletActivity[]>>;
1086
1127
  getGatedContent(contractAddress: string, clerkToken: string): Promise<{
1087
1128
  title: string;
1088
1129
  url: string;
@@ -1204,6 +1245,15 @@ declare class ApiClient {
1204
1245
  getCoin(contract: string): Promise<{
1205
1246
  data: ApiCoin;
1206
1247
  }>;
1248
+ /**
1249
+ * Creator-authed coin profile edit (image/description). Backend authorizes
1250
+ * via `coin.creator` (trustless — from the factory event), not a body param;
1251
+ * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
1252
+ */
1253
+ updateCoinProfile(contract: string, data: {
1254
+ image?: string;
1255
+ description?: string;
1256
+ }, siwsToken: string): Promise<ApiResponse<ApiCoin>>;
1207
1257
  getDropCollections(opts?: {
1208
1258
  page?: number;
1209
1259
  limit?: number;
@@ -1357,4 +1407,4 @@ interface ProposeSponsorshipParams {
1357
1407
  royaltyBps: bigint | string;
1358
1408
  }
1359
1409
 
1360
- export { type ApiTokenBalance as $, type ActivityType as A, type ApiOrderConsideration as B, type ApiOrderOffer as C, type ApiOrderPrice as D, type ApiOrderTokenMeta as E, type ApiOrderTxHash as F, type ApiOrdersQuery as G, type ApiPointEvent as H, type ApiPortalKey as I, type ApiPortalKeyCreated as J, type ApiPortalMe as K, type ApiPublicRemix as L, type ApiRemixOffer as M, type ApiRemixOfferPrice as N, type ApiRemixOffersQuery as O, type ApiResponse as P, type ApiRewardsBadge as Q, type ApiRewardsBatchEntry as R, type ServiceDefinition as S, type ApiRewardsConfig as T, type ApiRewardsLeaderboardEntry as U, type ApiRewardsLevel as V, type ApiSearchCollectionResult as W, type ApiSearchCreatorResult as X, type ApiSearchResult as Y, type ApiSearchTokenResult as Z, type ApiToken as _, type ServiceCapability as a, type WebhookStatus as a$, type ApiTokenMetadata as a0, type ApiUsageDay as a1, type ApiUserRewards as a2, type ApiUserWallet as a3, type ApiWebhookCreated as a4, type ApiWebhookEndpoint as a5, type AutoRemixOfferParams as a6, type CancelOrderIntentParams as a7, type ChainFilter as a8, type ClaimConditions as a9, type IpNftMetadata as aA, type MakeOfferIntentParams as aB, MedialaneApiError as aC, type MedialaneConfig as aD, type MedialaneErrorCode as aE, type MintMembershipsParams as aF, type MintTicketsParams as aG, OPEN_LICENSES as aH, type OfferItem as aI, type OpenLicense as aJ, type Order as aK, type OrderDetails as aL, type OrderParameters as aM, type OrderStatus as aN, type PopBatchEligibilityItem as aO, type PopClaimStatus as aP, type PopEventType as aQ, type ProposeSponsorshipParams as aR, type RemixOfferStatus as aS, type ResolvedConfig as aT, type ResolvedFeeConfig as aU, type RetryOptions as aV, type ServiceEventDeclaration as aW, type SortOrder as aX, type TenantPlan as aY, type TxResult as aZ, type WebhookEventType as a_, type CollectionSort as aa, type CollectionTokensSort as ab, type ConfirmRemixOfferParams as ac, type ConfirmSelfRemixParams as ad, type ConsiderationItem as ae, type CreateCollectionIntentParams as af, type CreateCounterOfferIntentParams as ag, type CreateDropParams as ah, type CreateListingIntentParams as ai, type CreateMembershipParams as aj, type CreateMintIntentParams as ak, type CreatePopCollectionParams as al, type CreateRemixOfferParams as am, type CreateSponsorshipOfferParams as an, type CreateTicketParams as ao, type CreateWebhookParams as ap, type DropMintStatus as aq, type EnforcementDeclaration as ar, type FeeConfig as as, FeeConfigSchema as at, type FulfillOrderIntentParams as au, type IPType as av, type IntentCall as aw, type IntentStatus as ax, type IntentType as ay, type IpAttribute as az, type ApiActivitiesQuery as b, resolveConfig as b0, resolveFeeConfig as b1, type ApiActivity as c, type ApiActivityPrice as d, type ApiAdminCollectionClaim as e, type ApiAppSource as f, type ApiChain as g, ApiClient as h, type ApiCoin as i, type ApiCoinsQuery as j, type ApiCollection as k, type ApiCollectionClaim as l, type ApiCollectionProfile as m, type ApiCollectionSlugClaim as n, type ApiCollectionsQuery as o, type ApiComment as p, type ApiCounterOffersQuery as q, type ApiCreatorListResult as r, type ApiCreatorProfile as s, type ApiIntent as t, type ApiIntentCreated as u, type ApiKeyStatus as v, type ApiMeta as w, type ApiMetadataSignedUrl as x, type ApiMetadataUpload as y, type ApiOrder as z };
1410
+ export { type ApiToken as $, type ActivityType as A, type ApiOrder as B, type ApiOrderConsideration as C, type ApiOrderOffer as D, type ApiOrderPrice as E, type ApiOrderTokenMeta as F, type ApiOrderTxHash as G, type ApiOrdersQuery as H, type ApiPointEvent as I, type ApiPortalKey as J, type ApiPortalKeyCreated as K, type ApiPortalMe as L, type ApiPublicRemix as M, type ApiRemixOffer as N, type ApiRemixOfferPrice as O, type ApiRemixOffersQuery as P, type ApiResponse as Q, type ApiRewardsBadge as R, type ServiceDefinition as S, type ApiRewardsBatchEntry as T, type ApiRewardsConfig as U, type ApiRewardsLeaderboardEntry as V, type ApiRewardsLevel as W, type ApiSearchCollectionResult as X, type ApiSearchCreatorResult as Y, type ApiSearchResult as Z, type ApiSearchTokenResult as _, type ServiceCapability as a, type TxResult as a$, type ApiTokenBalance as a0, type ApiTokenMetadata as a1, type ApiUsageDay as a2, type ApiUserRewards as a3, type ApiUserWallet as a4, type ApiWalletActivity as a5, type ApiWebhookCreated as a6, type ApiWebhookEndpoint as a7, type AutoRemixOfferParams as a8, type CancelOrderIntentParams as a9, type IntentType as aA, type IpAttribute as aB, type IpNftMetadata as aC, type MakeOfferIntentParams as aD, MedialaneApiError as aE, type MedialaneConfig as aF, type MedialaneErrorCode as aG, type MintMembershipsParams as aH, type MintTicketsParams as aI, OPEN_LICENSES as aJ, type OfferItem as aK, type OpenLicense as aL, type Order as aM, type OrderDetails as aN, type OrderParameters as aO, type OrderStatus as aP, type PopBatchEligibilityItem as aQ, type PopClaimStatus as aR, type PopEventType as aS, type ProposeSponsorshipParams as aT, type RemixOfferStatus as aU, type ResolvedConfig as aV, type ResolvedFeeConfig as aW, type RetryOptions as aX, type ServiceEventDeclaration as aY, type SortOrder as aZ, type TenantPlan as a_, type ChainFilter as aa, type ClaimConditions as ab, type CollectionSort as ac, type CollectionTokensSort as ad, type ConfirmRemixOfferParams as ae, type ConfirmSelfRemixParams as af, type ConsiderationItem as ag, type CreateCollectionIntentParams as ah, type CreateCounterOfferIntentParams as ai, type CreateDropParams as aj, type CreateListingIntentParams as ak, type CreateMembershipParams as al, type CreateMintIntentParams as am, type CreatePopCollectionParams as an, type CreateRemixOfferParams as ao, type CreateSponsorshipOfferParams as ap, type CreateTicketParams as aq, type CreateWebhookParams as ar, type DropMintStatus as as, type EnforcementDeclaration as at, type FeeConfig as au, FeeConfigSchema as av, type FulfillOrderIntentParams as aw, type IPType as ax, type IntentCall as ay, type IntentStatus as az, type ApiActivitiesQuery as b, type WebhookEventType as b0, type WebhookStatus as b1, resolveConfig as b2, resolveFeeConfig as b3, type ApiActivity as c, type ApiActivityPrice as d, type ApiAdminCollectionClaim as e, type ApiAppSource as f, type ApiBusinessProvisioning as g, type ApiChain as h, ApiClient as i, type ApiCoin as j, type ApiCoinsQuery as k, type ApiCollection as l, type ApiCollectionClaim as m, type ApiCollectionProfile as n, type ApiCollectionSlugClaim as o, type ApiCollectionsQuery as p, type ApiComment as q, type ApiCounterOffersQuery as r, type ApiCreatorListResult as s, type ApiCreatorProfile as t, type ApiIntent as u, type ApiIntentCreated as v, type ApiKeyStatus as w, type ApiMeta as x, type ApiMetadataSignedUrl as y, type ApiMetadataUpload as z };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { C as Chain } from './types-Cdwb6lXp.cjs';
2
+ import { C as Chain } from './types-sIc3OCpo.cjs';
3
3
 
4
4
  interface RetryOptions {
5
5
  maxAttempts?: number;
@@ -884,6 +884,36 @@ interface ApiAdminCollectionClaim extends ApiCollectionClaim {
884
884
  reviewedAt: string | null;
885
885
  updatedAt: string;
886
886
  }
887
+ interface ApiBusinessProvisioning {
888
+ id: string;
889
+ accountId: string;
890
+ chain: string;
891
+ walletAddress: string;
892
+ /** Free-form (mirrors Identity.scheme) — "email" is the only scheme the backend
893
+ * delivers a claim link for on its own; any other scheme still registers, the
894
+ * business gets `claimUrl` back on the register response and delivers it itself. */
895
+ recipientScheme: string;
896
+ recipientValue: string;
897
+ interimOwnerPubkey: string;
898
+ newOwnerPubkey: string | null;
899
+ status: "DEPLOYED" | "HANDOFF" | "TRANSFERRED";
900
+ }
901
+ interface ApiWalletActivity {
902
+ id: string;
903
+ chain: string;
904
+ accountAddress: string;
905
+ type: "SEND" | "RECEIVE" | "SWAP" | "DEPLOY" | "GUARDIAN_SET" | "GUARDIAN_TRIGGER_ESCAPE" | "GUARDIAN_COMPLETE_ESCAPE" | "GUARDIAN_CANCEL_ESCAPE";
906
+ txHash: string;
907
+ blockNumber: string;
908
+ timestamp: string;
909
+ tokenAddress: string | null;
910
+ amount: string | null;
911
+ counterparty: string | null;
912
+ tokenInAddress: string | null;
913
+ amountIn: string | null;
914
+ tokenOutAddress: string | null;
915
+ amountOut: string | null;
916
+ }
887
917
  interface PopClaimStatus {
888
918
  isEligible: boolean;
889
919
  hasClaimed: boolean;
@@ -1078,11 +1108,22 @@ declare class ApiClient {
1078
1108
  }): Promise<{
1079
1109
  claim: ApiCollectionClaim;
1080
1110
  }>;
1111
+ registerBusinessProvisioning(params: {
1112
+ chain: "STARKNET";
1113
+ walletAddress: string;
1114
+ recipientScheme: string;
1115
+ recipientValue: string;
1116
+ interimOwnerPubkey: string;
1117
+ }): Promise<ApiResponse<ApiBusinessProvisioning & {
1118
+ claimUrl: string;
1119
+ }>>;
1120
+ completeBusinessProvisioning(id: string): Promise<ApiResponse<ApiBusinessProvisioning>>;
1081
1121
  getCollectionProfile(contractAddress: string): Promise<ApiCollectionProfile | null>;
1082
1122
  /**
1083
1123
  * Update collection profile. Requires Clerk JWT for ownership check.
1084
1124
  */
1085
1125
  updateCollectionProfile(contractAddress: string, data: Partial<Omit<ApiCollectionProfile, "contractAddress" | "chain" | "updatedBy" | "updatedAt">>, clerkToken: string): Promise<ApiCollectionProfile>;
1126
+ getWalletActivity(address: string, siwsToken: string, chain?: "STARKNET"): Promise<ApiResponse<ApiWalletActivity[]>>;
1086
1127
  getGatedContent(contractAddress: string, clerkToken: string): Promise<{
1087
1128
  title: string;
1088
1129
  url: string;
@@ -1204,6 +1245,15 @@ declare class ApiClient {
1204
1245
  getCoin(contract: string): Promise<{
1205
1246
  data: ApiCoin;
1206
1247
  }>;
1248
+ /**
1249
+ * Creator-authed coin profile edit (image/description). Backend authorizes
1250
+ * via `coin.creator` (trustless — from the factory event), not a body param;
1251
+ * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
1252
+ */
1253
+ updateCoinProfile(contract: string, data: {
1254
+ image?: string;
1255
+ description?: string;
1256
+ }, siwsToken: string): Promise<ApiResponse<ApiCoin>>;
1207
1257
  getDropCollections(opts?: {
1208
1258
  page?: number;
1209
1259
  limit?: number;
@@ -1357,4 +1407,4 @@ interface ProposeSponsorshipParams {
1357
1407
  royaltyBps: bigint | string;
1358
1408
  }
1359
1409
 
1360
- export { type ApiTokenBalance as $, type ActivityType as A, type ApiOrderConsideration as B, type ApiOrderOffer as C, type ApiOrderPrice as D, type ApiOrderTokenMeta as E, type ApiOrderTxHash as F, type ApiOrdersQuery as G, type ApiPointEvent as H, type ApiPortalKey as I, type ApiPortalKeyCreated as J, type ApiPortalMe as K, type ApiPublicRemix as L, type ApiRemixOffer as M, type ApiRemixOfferPrice as N, type ApiRemixOffersQuery as O, type ApiResponse as P, type ApiRewardsBadge as Q, type ApiRewardsBatchEntry as R, type ServiceDefinition as S, type ApiRewardsConfig as T, type ApiRewardsLeaderboardEntry as U, type ApiRewardsLevel as V, type ApiSearchCollectionResult as W, type ApiSearchCreatorResult as X, type ApiSearchResult as Y, type ApiSearchTokenResult as Z, type ApiToken as _, type ServiceCapability as a, type WebhookStatus as a$, type ApiTokenMetadata as a0, type ApiUsageDay as a1, type ApiUserRewards as a2, type ApiUserWallet as a3, type ApiWebhookCreated as a4, type ApiWebhookEndpoint as a5, type AutoRemixOfferParams as a6, type CancelOrderIntentParams as a7, type ChainFilter as a8, type ClaimConditions as a9, type IpNftMetadata as aA, type MakeOfferIntentParams as aB, MedialaneApiError as aC, type MedialaneConfig as aD, type MedialaneErrorCode as aE, type MintMembershipsParams as aF, type MintTicketsParams as aG, OPEN_LICENSES as aH, type OfferItem as aI, type OpenLicense as aJ, type Order as aK, type OrderDetails as aL, type OrderParameters as aM, type OrderStatus as aN, type PopBatchEligibilityItem as aO, type PopClaimStatus as aP, type PopEventType as aQ, type ProposeSponsorshipParams as aR, type RemixOfferStatus as aS, type ResolvedConfig as aT, type ResolvedFeeConfig as aU, type RetryOptions as aV, type ServiceEventDeclaration as aW, type SortOrder as aX, type TenantPlan as aY, type TxResult as aZ, type WebhookEventType as a_, type CollectionSort as aa, type CollectionTokensSort as ab, type ConfirmRemixOfferParams as ac, type ConfirmSelfRemixParams as ad, type ConsiderationItem as ae, type CreateCollectionIntentParams as af, type CreateCounterOfferIntentParams as ag, type CreateDropParams as ah, type CreateListingIntentParams as ai, type CreateMembershipParams as aj, type CreateMintIntentParams as ak, type CreatePopCollectionParams as al, type CreateRemixOfferParams as am, type CreateSponsorshipOfferParams as an, type CreateTicketParams as ao, type CreateWebhookParams as ap, type DropMintStatus as aq, type EnforcementDeclaration as ar, type FeeConfig as as, FeeConfigSchema as at, type FulfillOrderIntentParams as au, type IPType as av, type IntentCall as aw, type IntentStatus as ax, type IntentType as ay, type IpAttribute as az, type ApiActivitiesQuery as b, resolveConfig as b0, resolveFeeConfig as b1, type ApiActivity as c, type ApiActivityPrice as d, type ApiAdminCollectionClaim as e, type ApiAppSource as f, type ApiChain as g, ApiClient as h, type ApiCoin as i, type ApiCoinsQuery as j, type ApiCollection as k, type ApiCollectionClaim as l, type ApiCollectionProfile as m, type ApiCollectionSlugClaim as n, type ApiCollectionsQuery as o, type ApiComment as p, type ApiCounterOffersQuery as q, type ApiCreatorListResult as r, type ApiCreatorProfile as s, type ApiIntent as t, type ApiIntentCreated as u, type ApiKeyStatus as v, type ApiMeta as w, type ApiMetadataSignedUrl as x, type ApiMetadataUpload as y, type ApiOrder as z };
1410
+ export { type ApiToken as $, type ActivityType as A, type ApiOrder as B, type ApiOrderConsideration as C, type ApiOrderOffer as D, type ApiOrderPrice as E, type ApiOrderTokenMeta as F, type ApiOrderTxHash as G, type ApiOrdersQuery as H, type ApiPointEvent as I, type ApiPortalKey as J, type ApiPortalKeyCreated as K, type ApiPortalMe as L, type ApiPublicRemix as M, type ApiRemixOffer as N, type ApiRemixOfferPrice as O, type ApiRemixOffersQuery as P, type ApiResponse as Q, type ApiRewardsBadge as R, type ServiceDefinition as S, type ApiRewardsBatchEntry as T, type ApiRewardsConfig as U, type ApiRewardsLeaderboardEntry as V, type ApiRewardsLevel as W, type ApiSearchCollectionResult as X, type ApiSearchCreatorResult as Y, type ApiSearchResult as Z, type ApiSearchTokenResult as _, type ServiceCapability as a, type TxResult as a$, type ApiTokenBalance as a0, type ApiTokenMetadata as a1, type ApiUsageDay as a2, type ApiUserRewards as a3, type ApiUserWallet as a4, type ApiWalletActivity as a5, type ApiWebhookCreated as a6, type ApiWebhookEndpoint as a7, type AutoRemixOfferParams as a8, type CancelOrderIntentParams as a9, type IntentType as aA, type IpAttribute as aB, type IpNftMetadata as aC, type MakeOfferIntentParams as aD, MedialaneApiError as aE, type MedialaneConfig as aF, type MedialaneErrorCode as aG, type MintMembershipsParams as aH, type MintTicketsParams as aI, OPEN_LICENSES as aJ, type OfferItem as aK, type OpenLicense as aL, type Order as aM, type OrderDetails as aN, type OrderParameters as aO, type OrderStatus as aP, type PopBatchEligibilityItem as aQ, type PopClaimStatus as aR, type PopEventType as aS, type ProposeSponsorshipParams as aT, type RemixOfferStatus as aU, type ResolvedConfig as aV, type ResolvedFeeConfig as aW, type RetryOptions as aX, type ServiceEventDeclaration as aY, type SortOrder as aZ, type TenantPlan as a_, type ChainFilter as aa, type ClaimConditions as ab, type CollectionSort as ac, type CollectionTokensSort as ad, type ConfirmRemixOfferParams as ae, type ConfirmSelfRemixParams as af, type ConsiderationItem as ag, type CreateCollectionIntentParams as ah, type CreateCounterOfferIntentParams as ai, type CreateDropParams as aj, type CreateListingIntentParams as ak, type CreateMembershipParams as al, type CreateMintIntentParams as am, type CreatePopCollectionParams as an, type CreateRemixOfferParams as ao, type CreateSponsorshipOfferParams as ap, type CreateTicketParams as aq, type CreateWebhookParams as ar, type DropMintStatus as as, type EnforcementDeclaration as at, type FeeConfig as au, FeeConfigSchema as av, type FulfillOrderIntentParams as aw, type IPType as ax, type IntentCall as ay, type IntentStatus as az, type ApiActivitiesQuery as b, type WebhookEventType as b0, type WebhookStatus as b1, resolveConfig as b2, resolveFeeConfig as b3, type ApiActivity as c, type ApiActivityPrice as d, type ApiAdminCollectionClaim as e, type ApiAppSource as f, type ApiBusinessProvisioning as g, type ApiChain as h, ApiClient as i, type ApiCoin as j, type ApiCoinsQuery as k, type ApiCollection as l, type ApiCollectionClaim as m, type ApiCollectionProfile as n, type ApiCollectionSlugClaim as o, type ApiCollectionsQuery as p, type ApiComment as q, type ApiCounterOffersQuery as r, type ApiCreatorListResult as s, type ApiCreatorProfile as t, type ApiIntent as u, type ApiIntentCreated as v, type ApiKeyStatus as w, type ApiMeta as x, type ApiMetadataSignedUrl as y, type ApiMetadataUpload as z };
@@ -143,7 +143,8 @@ var COORDINATES = {
143
143
  // zero offers/licenses ever issued (clean cutover, no reclassification).
144
144
  ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
145
145
  ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
146
- ipSponsorshipStartBlock: 11896456
146
+ ipSponsorshipStartBlock: 11896456,
147
+ mediaWalletClassHash: "0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31"
147
148
  }
148
149
  };
149
150
  function getCoordinates(chain) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/solana/encoding.ts","../../src/chains.ts","../../src/solana/venue.ts"],"names":["sha256","PublicKey","TransactionInstruction","SystemProgram","Transaction"],"mappings":";;;;;;AAUO,SAAS,yBAAyB,IAAA,EAA0B;AACjE,EAAA,OAAOA,cAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,CAAA,OAAA,EAAU,IAAI,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AACtE;AAEO,SAAS,mBAAmB,IAAA,EAA0B;AAC3D,EAAA,OAAOA,cAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AACrE;AAGO,IAAM,cAAN,MAAkB;AAAA,EAAlB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAuB,EAAC;AAAA,EAAA;AAAA,EAEhC,GAAG,CAAA,EAAiB;AAClB,IAAA,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,UAAA,CAAW,EAAA,CAAG,CAAC,CAAC,CAAA;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EACA,IAAI,CAAA,EAAiB;AACnB,IAAA,MAAM,CAAA,GAAI,IAAI,UAAA,CAAW,CAAC,CAAA;AAC1B,IAAA,IAAI,SAA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,CAAE,IAAI,WAAW,CAAA;AAC5C,IAAA,EAAA,CAAG,WAAW,MAAA,CAAO,SAAA;AACrB,IAAA,EAAA,CAAG,eAAA,GAAA,CAAmB,MAAM,IAAA,CAAK,UAAA,CAAW,oBAAmB,EAAG,SAAA;AAClE,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,eAAA,CAAgB,EAAE,CAAA;AAC9C,IAAA,OAAO,IAAA,CAAK,UAAA,CAAW,kBAAA,CAAmB,MAAA,CAAO,WAAW,CAAA;AAAA,EAC9D;AACF;AAEA,SAAS,WAAA,GAA6C;AACpD,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,QAAQ,CAAA;AAAA,EAChC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.cjs","sourcesContent":["import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { PublicKey } from \"@solana/web3.js\";\n\n/**\n * Anchor wire encoding for the Medialane Solana programs — discriminators,\n * a minimal borsh writer for our argument shapes, and the programs' PDAs.\n * Verified against the audited Rust (Solana-MIP-Collections,\n * Solana-Marketplace); no Anchor client dependency.\n */\n\nexport function instructionDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`global:${name}`)).slice(0, 8);\n}\n\nexport function eventDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`event:${name}`)).slice(0, 8);\n}\n\n/** Minimal borsh writer covering our programs' argument types. */\nexport class BorshWriter {\n private chunks: Uint8Array[] = [];\n\n u8(v: number): this {\n this.chunks.push(Uint8Array.of(v));\n return this;\n }\n u16(v: number): this {\n const b = new Uint8Array(2);\n new DataView(b.buffer).setUint16(0, v, true);\n this.chunks.push(b);\n return this;\n }\n u64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n i64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigInt64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n string(v: string): this {\n const bytes = new TextEncoder().encode(v);\n const len = new Uint8Array(4);\n new DataView(len.buffer).setUint32(0, bytes.length, true);\n this.chunks.push(len, bytes);\n return this;\n }\n pubkey(v: PublicKey): this {\n this.chunks.push(v.toBytes());\n return this;\n }\n option<T>(v: T | null | undefined, write: (value: T) => void): this {\n if (v === null || v === undefined) {\n this.u8(0);\n } else {\n this.u8(1);\n write(v);\n }\n return this;\n }\n build(discriminator: Uint8Array): Uint8Array {\n const total = this.chunks.reduce((n, c) => n + c.length, discriminator.length);\n const out = new Uint8Array(total);\n out.set(discriminator, 0);\n let offset = discriminator.length;\n for (const chunk of this.chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n }\n}\n\nexport function u64le(v: bigint): Uint8Array {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n return b;\n}\n\n// ─── PDAs (seeds copied from the Rust) ───────────────────────────────────────\n\nexport function orderPda(program: PublicKey, offerer: PublicKey, salt: bigint): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"order\"), offerer.toBytes(), u64le(salt)],\n program,\n )[0];\n}\n\nexport function counterPda(program: PublicKey, offerer: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"counter\"), offerer.toBytes()],\n program,\n )[0];\n}\n\nexport function settlementPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"authority\")], program)[0];\n}\n\nexport function registryCounterPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"counter\")], program)[0];\n}\n\nexport function collectionRecordPda(program: PublicKey, coreCollection: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"collection\"), coreCollection.toBytes()],\n program,\n )[0];\n}\n\nexport const MPL_CORE_PROGRAM_ID = new PublicKey(\"CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d\");\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import {\n PublicKey,\n SystemProgram,\n Transaction,\n TransactionInstruction,\n type Connection,\n} from \"@solana/web3.js\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type SolanaCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport {\n BorshWriter,\n MPL_CORE_PROGRAM_ID,\n counterPda,\n instructionDiscriminator,\n orderPda,\n settlementPda,\n} from \"./encoding.js\";\n\n/** Wallet-adapter-compatible signer. */\nexport interface SolanaSigner {\n publicKey: PublicKey;\n signTransaction(tx: Transaction): Promise<Transaction>;\n}\n\nexport interface SolanaVenueOptions {\n connection: Connection;\n /** Defaults to the chain registry's marketplace program (populated at deploy). */\n programId?: string;\n}\n\n/** The Medialane venue adapter for Solana. The canonical order id is the\n * order PDA (spec §3.2b). Native SOL is the payment when `paymentToken`\n * is the \"native\" sentinel; SPL mints otherwise (bids are SPL-only,\n * enforced by the program). */\nexport class SolanaVenue implements VenueAdapter<SolanaSigner> {\n readonly chain: Chain = \"SOLANA\";\n private readonly connection: Connection;\n private readonly program: PublicKey;\n\n constructor(opts: SolanaVenueOptions) {\n this.connection = opts.connection;\n const program = opts.programId ?? maybeCoords()?.marketplaceProgram;\n if (!program) throw new Error(\"No Solana marketplace program configured\");\n this.program = new PublicKey(program);\n }\n\n async registerOrder(\n signer: SolanaSigner,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const offerer = signer.publicKey;\n const salt = BigInt(params.salt);\n const isNative = params.paymentToken === \"native\";\n const counter = await this.getCounter(offerer.toBase58());\n const writer = new BorshWriter()\n .u64(salt)\n .u8(params.side === \"listing\" ? 0 : 1)\n .option(isNative ? null : new PublicKey(params.paymentToken), (mint) => writer.pubkey(mint))\n .u64(BigInt(params.amount))\n .u16(params.royaltyMaxBps)\n .i64(BigInt(params.startTime))\n .i64(BigInt(params.endTime))\n .u64(counter);\n const order = orderPda(this.program, offerer, salt);\n const asset = new PublicKey(params.asset.contract);\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: offerer, isSigner: true, isWritable: true },\n { pubkey: order, isSigner: false, isWritable: true },\n { pubkey: counterPda(this.program, offerer), isSigner: false, isWritable: true },\n { pubkey: settlementPda(this.program), isSigner: false, isWritable: false },\n { pubkey: asset, isSigner: false, isWritable: true },\n { pubkey: new PublicKey(params.asset.tokenId), isSigner: false, isWritable: true },\n { pubkey: MPL_CORE_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(writer.build(instructionDiscriminator(\"register_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash, orderRef: order.toBase58() };\n }\n\n async fulfillOrder(): Promise<AdapterTxResult> {\n throw new Error(\n \"Solana fulfillment requires the order's creator remaining-accounts; use buildFulfillInstruction with explicit accounts\",\n );\n }\n\n async cancelOrder(signer: SolanaSigner, orderRef: OrderRef): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: false },\n { pubkey: new PublicKey(orderRef), isSigner: false, isWritable: true },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"cancel_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async incrementCounter(signer: SolanaSigner): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: true },\n { pubkey: counterPda(this.program, signer.publicKey), isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"increment_counter\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n const info = await this.connection.getAccountInfo(new PublicKey(orderRef));\n return info?.data ?? null;\n }\n\n async getCounter(address: string): Promise<bigint> {\n const pda = counterPda(this.program, new PublicKey(address));\n const info = await this.connection.getAccountInfo(pda);\n if (!info || info.data.length < 16) return 0n;\n // Anchor account: 8-byte discriminator + u64 count (LE).\n return new DataView(info.data.buffer, info.data.byteOffset + 8, 8).getBigUint64(0, true);\n }\n\n private async send(signer: SolanaSigner, instruction: TransactionInstruction): Promise<string> {\n const tx = new Transaction().add(instruction);\n tx.feePayer = signer.publicKey;\n tx.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash;\n const signed = await signer.signTransaction(tx);\n return this.connection.sendRawTransaction(signed.serialize());\n }\n}\n\nfunction maybeCoords(): SolanaCoordinates | undefined {\n try {\n return getCoordinates(\"SOLANA\");\n } catch {\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/solana/encoding.ts","../../src/chains.ts","../../src/solana/venue.ts"],"names":["sha256","PublicKey","TransactionInstruction","SystemProgram","Transaction"],"mappings":";;;;;;AAUO,SAAS,yBAAyB,IAAA,EAA0B;AACjE,EAAA,OAAOA,cAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,CAAA,OAAA,EAAU,IAAI,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AACtE;AAEO,SAAS,mBAAmB,IAAA,EAA0B;AAC3D,EAAA,OAAOA,cAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,C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AIA,iBAAAA,CAAU,OAAO,CAAC,CAAA;AAC3D,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,UAAA,CAAW,eAAe,GAAG,CAAA;AACrD,IAAA,IAAI,CAAC,IAAA,IAAQ,IAAA,CAAK,IAAA,CAAK,MAAA,GAAS,IAAI,OAAO,EAAA;AAE3C,IAAA,OAAO,IAAI,QAAA,CAAS,IAAA,CAAK,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK,IAAA,CAAK,UAAA,GAAa,CAAA,EAAG,CAAC,CAAA,CAAE,YAAA,CAAa,GAAG,IAAI,CAAA;AAAA,EACzF;AAAA,EAEA,MAAc,IAAA,CAAK,MAAA,EAAsB,WAAA,EAAsD;AAC7F,IAAA,MAAM,EAAA,GAAK,IAAIG,mBAAA,EAAY,CAAE,IAAI,WAAW,CAAA;AAC5C,IAAA,EAAA,CAAG,WAAW,MAAA,CAAO,SAAA;AACrB,IAAA,EAAA,CAAG,eAAA,GAAA,CAAmB,MAAM,IAAA,CAAK,UAAA,CAAW,oBAAmB,EAAG,SAAA;AAClE,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,eAAA,CAAgB,EAAE,CAAA;AAC9C,IAAA,OAAO,IAAA,CAAK,UAAA,CAAW,kBAAA,CAAmB,MAAA,CAAO,WAAW,CAAA;AAAA,EAC9D;AACF;AAEA,SAAS,WAAA,GAA6C;AACpD,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,QAAQ,CAAA;AAAA,EAChC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.cjs","sourcesContent":["import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { PublicKey } from \"@solana/web3.js\";\n\n/**\n * Anchor wire encoding for the Medialane Solana programs — discriminators,\n * a minimal borsh writer for our argument shapes, and the programs' PDAs.\n * Verified against the audited Rust (Solana-MIP-Collections,\n * Solana-Marketplace); no Anchor client dependency.\n */\n\nexport function instructionDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`global:${name}`)).slice(0, 8);\n}\n\nexport function eventDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`event:${name}`)).slice(0, 8);\n}\n\n/** Minimal borsh writer covering our programs' argument types. */\nexport class BorshWriter {\n private chunks: Uint8Array[] = [];\n\n u8(v: number): this {\n this.chunks.push(Uint8Array.of(v));\n return this;\n }\n u16(v: number): this {\n const b = new Uint8Array(2);\n new DataView(b.buffer).setUint16(0, v, true);\n this.chunks.push(b);\n return this;\n }\n u64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n i64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigInt64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n string(v: string): this {\n const bytes = new TextEncoder().encode(v);\n const len = new Uint8Array(4);\n new DataView(len.buffer).setUint32(0, bytes.length, true);\n this.chunks.push(len, bytes);\n return this;\n }\n pubkey(v: PublicKey): this {\n this.chunks.push(v.toBytes());\n return this;\n }\n option<T>(v: T | null | undefined, write: (value: T) => void): this {\n if (v === null || v === undefined) {\n this.u8(0);\n } else {\n this.u8(1);\n write(v);\n }\n return this;\n }\n build(discriminator: Uint8Array): Uint8Array {\n const total = this.chunks.reduce((n, c) => n + c.length, discriminator.length);\n const out = new Uint8Array(total);\n out.set(discriminator, 0);\n let offset = discriminator.length;\n for (const chunk of this.chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n }\n}\n\nexport function u64le(v: bigint): Uint8Array {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n return b;\n}\n\n// ─── PDAs (seeds copied from the Rust) ───────────────────────────────────────\n\nexport function orderPda(program: PublicKey, offerer: PublicKey, salt: bigint): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"order\"), offerer.toBytes(), u64le(salt)],\n program,\n )[0];\n}\n\nexport function counterPda(program: PublicKey, offerer: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"counter\"), offerer.toBytes()],\n program,\n )[0];\n}\n\nexport function settlementPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"authority\")], program)[0];\n}\n\nexport function registryCounterPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"counter\")], program)[0];\n}\n\nexport function collectionRecordPda(program: PublicKey, coreCollection: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"collection\"), coreCollection.toBytes()],\n program,\n )[0];\n}\n\nexport const MPL_CORE_PROGRAM_ID = new PublicKey(\"CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d\");\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import {\n PublicKey,\n SystemProgram,\n Transaction,\n TransactionInstruction,\n type Connection,\n} from \"@solana/web3.js\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type SolanaCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport {\n BorshWriter,\n MPL_CORE_PROGRAM_ID,\n counterPda,\n instructionDiscriminator,\n orderPda,\n settlementPda,\n} from \"./encoding.js\";\n\n/** Wallet-adapter-compatible signer. */\nexport interface SolanaSigner {\n publicKey: PublicKey;\n signTransaction(tx: Transaction): Promise<Transaction>;\n}\n\nexport interface SolanaVenueOptions {\n connection: Connection;\n /** Defaults to the chain registry's marketplace program (populated at deploy). */\n programId?: string;\n}\n\n/** The Medialane venue adapter for Solana. The canonical order id is the\n * order PDA (spec §3.2b). Native SOL is the payment when `paymentToken`\n * is the \"native\" sentinel; SPL mints otherwise (bids are SPL-only,\n * enforced by the program). */\nexport class SolanaVenue implements VenueAdapter<SolanaSigner> {\n readonly chain: Chain = \"SOLANA\";\n private readonly connection: Connection;\n private readonly program: PublicKey;\n\n constructor(opts: SolanaVenueOptions) {\n this.connection = opts.connection;\n const program = opts.programId ?? maybeCoords()?.marketplaceProgram;\n if (!program) throw new Error(\"No Solana marketplace program configured\");\n this.program = new PublicKey(program);\n }\n\n async registerOrder(\n signer: SolanaSigner,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const offerer = signer.publicKey;\n const salt = BigInt(params.salt);\n const isNative = params.paymentToken === \"native\";\n const counter = await this.getCounter(offerer.toBase58());\n const writer = new BorshWriter()\n .u64(salt)\n .u8(params.side === \"listing\" ? 0 : 1)\n .option(isNative ? null : new PublicKey(params.paymentToken), (mint) => writer.pubkey(mint))\n .u64(BigInt(params.amount))\n .u16(params.royaltyMaxBps)\n .i64(BigInt(params.startTime))\n .i64(BigInt(params.endTime))\n .u64(counter);\n const order = orderPda(this.program, offerer, salt);\n const asset = new PublicKey(params.asset.contract);\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: offerer, isSigner: true, isWritable: true },\n { pubkey: order, isSigner: false, isWritable: true },\n { pubkey: counterPda(this.program, offerer), isSigner: false, isWritable: true },\n { pubkey: settlementPda(this.program), isSigner: false, isWritable: false },\n { pubkey: asset, isSigner: false, isWritable: true },\n { pubkey: new PublicKey(params.asset.tokenId), isSigner: false, isWritable: true },\n { pubkey: MPL_CORE_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(writer.build(instructionDiscriminator(\"register_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash, orderRef: order.toBase58() };\n }\n\n async fulfillOrder(): Promise<AdapterTxResult> {\n throw new Error(\n \"Solana fulfillment requires the order's creator remaining-accounts; use buildFulfillInstruction with explicit accounts\",\n );\n }\n\n async cancelOrder(signer: SolanaSigner, orderRef: OrderRef): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: false },\n { pubkey: new PublicKey(orderRef), isSigner: false, isWritable: true },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"cancel_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async incrementCounter(signer: SolanaSigner): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: true },\n { pubkey: counterPda(this.program, signer.publicKey), isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"increment_counter\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n const info = await this.connection.getAccountInfo(new PublicKey(orderRef));\n return info?.data ?? null;\n }\n\n async getCounter(address: string): Promise<bigint> {\n const pda = counterPda(this.program, new PublicKey(address));\n const info = await this.connection.getAccountInfo(pda);\n if (!info || info.data.length < 16) return 0n;\n // Anchor account: 8-byte discriminator + u64 count (LE).\n return new DataView(info.data.buffer, info.data.byteOffset + 8, 8).getBigUint64(0, true);\n }\n\n private async send(signer: SolanaSigner, instruction: TransactionInstruction): Promise<string> {\n const tx = new Transaction().add(instruction);\n tx.feePayer = signer.publicKey;\n tx.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash;\n const signed = await signer.signTransaction(tx);\n return this.connection.sendRawTransaction(signed.serialize());\n }\n}\n\nfunction maybeCoords(): SolanaCoordinates | undefined {\n try {\n return getCoordinates(\"SOLANA\");\n } catch {\n return undefined;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { PublicKey, Transaction, Connection } from '@solana/web3.js';
2
- import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-Cdwb6lXp.cjs';
2
+ import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-sIc3OCpo.cjs';
3
3
 
4
4
  /**
5
5
  * Anchor wire encoding for the Medialane Solana programs — discriminators,
@@ -1,5 +1,5 @@
1
1
  import { PublicKey, Transaction, Connection } from '@solana/web3.js';
2
- import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-Cdwb6lXp.js';
2
+ import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-sIc3OCpo.js';
3
3
 
4
4
  /**
5
5
  * Anchor wire encoding for the Medialane Solana programs — discriminators,
@@ -141,7 +141,8 @@ var COORDINATES = {
141
141
  // zero offers/licenses ever issued (clean cutover, no reclassification).
142
142
  ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
143
143
  ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
144
- ipSponsorshipStartBlock: 11896456
144
+ ipSponsorshipStartBlock: 11896456,
145
+ mediaWalletClassHash: "0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31"
145
146
  }
146
147
  };
147
148
  function getCoordinates(chain) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/solana/encoding.ts","../../src/chains.ts","../../src/solana/venue.ts"],"names":["PublicKey"],"mappings":";;;;AAUO,S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esContent":["import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { PublicKey } from \"@solana/web3.js\";\n\n/**\n * Anchor wire encoding for the Medialane Solana programs — discriminators,\n * a minimal borsh writer for our argument shapes, and the programs' PDAs.\n * Verified against the audited Rust (Solana-MIP-Collections,\n * Solana-Marketplace); no Anchor client dependency.\n */\n\nexport function instructionDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`global:${name}`)).slice(0, 8);\n}\n\nexport function eventDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`event:${name}`)).slice(0, 8);\n}\n\n/** Minimal borsh writer covering our programs' argument types. */\nexport class BorshWriter {\n private chunks: Uint8Array[] = [];\n\n u8(v: number): this {\n this.chunks.push(Uint8Array.of(v));\n return this;\n }\n u16(v: number): this {\n const b = new Uint8Array(2);\n new DataView(b.buffer).setUint16(0, v, true);\n this.chunks.push(b);\n return this;\n }\n u64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n i64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigInt64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n string(v: string): this {\n const bytes = new TextEncoder().encode(v);\n const len = new Uint8Array(4);\n new DataView(len.buffer).setUint32(0, bytes.length, true);\n this.chunks.push(len, bytes);\n return this;\n }\n pubkey(v: PublicKey): this {\n this.chunks.push(v.toBytes());\n return this;\n }\n option<T>(v: T | null | undefined, write: (value: T) => void): this {\n if (v === null || v === undefined) {\n this.u8(0);\n } else {\n this.u8(1);\n write(v);\n }\n return this;\n }\n build(discriminator: Uint8Array): Uint8Array {\n const total = this.chunks.reduce((n, c) => n + c.length, discriminator.length);\n const out = new Uint8Array(total);\n out.set(discriminator, 0);\n let offset = discriminator.length;\n for (const chunk of this.chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n }\n}\n\nexport function u64le(v: bigint): Uint8Array {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n return b;\n}\n\n// ─── PDAs (seeds copied from the Rust) ───────────────────────────────────────\n\nexport function orderPda(program: PublicKey, offerer: PublicKey, salt: bigint): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"order\"), offerer.toBytes(), u64le(salt)],\n program,\n )[0];\n}\n\nexport function counterPda(program: PublicKey, offerer: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"counter\"), offerer.toBytes()],\n program,\n )[0];\n}\n\nexport function settlementPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"authority\")], program)[0];\n}\n\nexport function registryCounterPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"counter\")], program)[0];\n}\n\nexport function collectionRecordPda(program: PublicKey, coreCollection: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"collection\"), coreCollection.toBytes()],\n program,\n )[0];\n}\n\nexport const MPL_CORE_PROGRAM_ID = new PublicKey(\"CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d\");\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import {\n PublicKey,\n SystemProgram,\n Transaction,\n TransactionInstruction,\n type Connection,\n} from \"@solana/web3.js\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type SolanaCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport {\n BorshWriter,\n MPL_CORE_PROGRAM_ID,\n counterPda,\n instructionDiscriminator,\n orderPda,\n settlementPda,\n} from \"./encoding.js\";\n\n/** Wallet-adapter-compatible signer. */\nexport interface SolanaSigner {\n publicKey: PublicKey;\n signTransaction(tx: Transaction): Promise<Transaction>;\n}\n\nexport interface SolanaVenueOptions {\n connection: Connection;\n /** Defaults to the chain registry's marketplace program (populated at deploy). */\n programId?: string;\n}\n\n/** The Medialane venue adapter for Solana. The canonical order id is the\n * order PDA (spec §3.2b). Native SOL is the payment when `paymentToken`\n * is the \"native\" sentinel; SPL mints otherwise (bids are SPL-only,\n * enforced by the program). */\nexport class SolanaVenue implements VenueAdapter<SolanaSigner> {\n readonly chain: Chain = \"SOLANA\";\n private readonly connection: Connection;\n private readonly program: PublicKey;\n\n constructor(opts: SolanaVenueOptions) {\n this.connection = opts.connection;\n const program = opts.programId ?? maybeCoords()?.marketplaceProgram;\n if (!program) throw new Error(\"No Solana marketplace program configured\");\n this.program = new PublicKey(program);\n }\n\n async registerOrder(\n signer: SolanaSigner,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const offerer = signer.publicKey;\n const salt = BigInt(params.salt);\n const isNative = params.paymentToken === \"native\";\n const counter = await this.getCounter(offerer.toBase58());\n const writer = new BorshWriter()\n .u64(salt)\n .u8(params.side === \"listing\" ? 0 : 1)\n .option(isNative ? null : new PublicKey(params.paymentToken), (mint) => writer.pubkey(mint))\n .u64(BigInt(params.amount))\n .u16(params.royaltyMaxBps)\n .i64(BigInt(params.startTime))\n .i64(BigInt(params.endTime))\n .u64(counter);\n const order = orderPda(this.program, offerer, salt);\n const asset = new PublicKey(params.asset.contract);\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: offerer, isSigner: true, isWritable: true },\n { pubkey: order, isSigner: false, isWritable: true },\n { pubkey: counterPda(this.program, offerer), isSigner: false, isWritable: true },\n { pubkey: settlementPda(this.program), isSigner: false, isWritable: false },\n { pubkey: asset, isSigner: false, isWritable: true },\n { pubkey: new PublicKey(params.asset.tokenId), isSigner: false, isWritable: true },\n { pubkey: MPL_CORE_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(writer.build(instructionDiscriminator(\"register_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash, orderRef: order.toBase58() };\n }\n\n async fulfillOrder(): Promise<AdapterTxResult> {\n throw new Error(\n \"Solana fulfillment requires the order's creator remaining-accounts; use buildFulfillInstruction with explicit accounts\",\n );\n }\n\n async cancelOrder(signer: SolanaSigner, orderRef: OrderRef): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: false },\n { pubkey: new PublicKey(orderRef), isSigner: false, isWritable: true },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"cancel_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async incrementCounter(signer: SolanaSigner): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: true },\n { pubkey: counterPda(this.program, signer.publicKey), isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"increment_counter\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n const info = await this.connection.getAccountInfo(new PublicKey(orderRef));\n return info?.data ?? null;\n }\n\n async getCounter(address: string): Promise<bigint> {\n const pda = counterPda(this.program, new PublicKey(address));\n const info = await this.connection.getAccountInfo(pda);\n if (!info || info.data.length < 16) return 0n;\n // Anchor account: 8-byte discriminator + u64 count (LE).\n return new DataView(info.data.buffer, info.data.byteOffset + 8, 8).getBigUint64(0, true);\n }\n\n private async send(signer: SolanaSigner, instruction: TransactionInstruction): Promise<string> {\n const tx = new Transaction().add(instruction);\n tx.feePayer = signer.publicKey;\n tx.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash;\n const signed = await signer.signTransaction(tx);\n return this.connection.sendRawTransaction(signed.serialize());\n }\n}\n\nfunction maybeCoords(): SolanaCoordinates | undefined {\n try {\n return getCoordinates(\"SOLANA\");\n } catch {\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/solana/encoding.ts","../../src/chains.ts","../../src/solana/venue.ts"],"names":["PublicKey"],"mappings":";;;;AAUO,SAAS,yBAAyB,IAAA,EAA0B;AACjE,EAAA,OAAO,MAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,CAAA,OAAA,EAAU,IAAI,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AACtE;AAEO,SAAS,mBAAmB,IAAA,EAA0B;AAC3D,EAAA,OAAO,MAAA,CAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AACrE;AAGO,IAAM,cAAN,MAAkB;AAAA,EAAlB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAuB,EAAC;AAAA,EAAA;AAAA,EAEhC,GAAG,CAAA,EAAiB;AAClB,IAAA,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,UAAA,CAAW,EAAA,CAAG,CAAC,CAAC,CAAA;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EACA,IAAI,CAAA,EAAiB;AACnB,IAAA,MAAM,CAAA,GAAI,IAAI,UAAA,CAAW,CAAC,CAAA;AAC1B,IAAA,IAAI,SAAS,CAAA,CAAE,MAAM,EAAE,SAAA,CAAU,CAAA,EAAG,GAAG,IAAI,CAAA;AAC3C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AAA;AACrB,IAAA,EAAA,CAAG,eAAA,GAAA,CAAmB,MAAM,IAAA,CAAK,UAAA,CAAW,oBAAmB,EAAG,SAAA;AAClE,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,eAAA,CAAgB,EAAE,CAAA;AAC9C,IAAA,OAAO,IAAA,CAAK,UAAA,CAAW,kBAAA,CAAmB,MAAA,CAAO,WAAW,CAAA;AAAA,EAC9D;AACF;AAEA,SAAS,WAAA,GAA6C;AACpD,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,QAAQ,CAAA;AAAA,EAChC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { PublicKey } from \"@solana/web3.js\";\n\n/**\n * Anchor wire encoding for the Medialane Solana programs — discriminators,\n * a minimal borsh writer for our argument shapes, and the programs' PDAs.\n * Verified against the audited Rust (Solana-MIP-Collections,\n * Solana-Marketplace); no Anchor client dependency.\n */\n\nexport function instructionDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`global:${name}`)).slice(0, 8);\n}\n\nexport function eventDiscriminator(name: string): Uint8Array {\n return sha256(new TextEncoder().encode(`event:${name}`)).slice(0, 8);\n}\n\n/** Minimal borsh writer covering our programs' argument types. */\nexport class BorshWriter {\n private chunks: Uint8Array[] = [];\n\n u8(v: number): this {\n this.chunks.push(Uint8Array.of(v));\n return this;\n }\n u16(v: number): this {\n const b = new Uint8Array(2);\n new DataView(b.buffer).setUint16(0, v, true);\n this.chunks.push(b);\n return this;\n }\n u64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n i64(v: bigint): this {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigInt64(0, v, true);\n this.chunks.push(b);\n return this;\n }\n string(v: string): this {\n const bytes = new TextEncoder().encode(v);\n const len = new Uint8Array(4);\n new DataView(len.buffer).setUint32(0, bytes.length, true);\n this.chunks.push(len, bytes);\n return this;\n }\n pubkey(v: PublicKey): this {\n this.chunks.push(v.toBytes());\n return this;\n }\n option<T>(v: T | null | undefined, write: (value: T) => void): this {\n if (v === null || v === undefined) {\n this.u8(0);\n } else {\n this.u8(1);\n write(v);\n }\n return this;\n }\n build(discriminator: Uint8Array): Uint8Array {\n const total = this.chunks.reduce((n, c) => n + c.length, discriminator.length);\n const out = new Uint8Array(total);\n out.set(discriminator, 0);\n let offset = discriminator.length;\n for (const chunk of this.chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n }\n}\n\nexport function u64le(v: bigint): Uint8Array {\n const b = new Uint8Array(8);\n new DataView(b.buffer).setBigUint64(0, v, true);\n return b;\n}\n\n// ─── PDAs (seeds copied from the Rust) ───────────────────────────────────────\n\nexport function orderPda(program: PublicKey, offerer: PublicKey, salt: bigint): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"order\"), offerer.toBytes(), u64le(salt)],\n program,\n )[0];\n}\n\nexport function counterPda(program: PublicKey, offerer: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"counter\"), offerer.toBytes()],\n program,\n )[0];\n}\n\nexport function settlementPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"authority\")], program)[0];\n}\n\nexport function registryCounterPda(program: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync([new TextEncoder().encode(\"counter\")], program)[0];\n}\n\nexport function collectionRecordPda(program: PublicKey, coreCollection: PublicKey): PublicKey {\n return PublicKey.findProgramAddressSync(\n [new TextEncoder().encode(\"collection\"), coreCollection.toBytes()],\n program,\n )[0];\n}\n\nexport const MPL_CORE_PROGRAM_ID = new PublicKey(\"CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d\");\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import {\n PublicKey,\n SystemProgram,\n Transaction,\n TransactionInstruction,\n type Connection,\n} from \"@solana/web3.js\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type SolanaCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport {\n BorshWriter,\n MPL_CORE_PROGRAM_ID,\n counterPda,\n instructionDiscriminator,\n orderPda,\n settlementPda,\n} from \"./encoding.js\";\n\n/** Wallet-adapter-compatible signer. */\nexport interface SolanaSigner {\n publicKey: PublicKey;\n signTransaction(tx: Transaction): Promise<Transaction>;\n}\n\nexport interface SolanaVenueOptions {\n connection: Connection;\n /** Defaults to the chain registry's marketplace program (populated at deploy). */\n programId?: string;\n}\n\n/** The Medialane venue adapter for Solana. The canonical order id is the\n * order PDA (spec §3.2b). Native SOL is the payment when `paymentToken`\n * is the \"native\" sentinel; SPL mints otherwise (bids are SPL-only,\n * enforced by the program). */\nexport class SolanaVenue implements VenueAdapter<SolanaSigner> {\n readonly chain: Chain = \"SOLANA\";\n private readonly connection: Connection;\n private readonly program: PublicKey;\n\n constructor(opts: SolanaVenueOptions) {\n this.connection = opts.connection;\n const program = opts.programId ?? maybeCoords()?.marketplaceProgram;\n if (!program) throw new Error(\"No Solana marketplace program configured\");\n this.program = new PublicKey(program);\n }\n\n async registerOrder(\n signer: SolanaSigner,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const offerer = signer.publicKey;\n const salt = BigInt(params.salt);\n const isNative = params.paymentToken === \"native\";\n const counter = await this.getCounter(offerer.toBase58());\n const writer = new BorshWriter()\n .u64(salt)\n .u8(params.side === \"listing\" ? 0 : 1)\n .option(isNative ? null : new PublicKey(params.paymentToken), (mint) => writer.pubkey(mint))\n .u64(BigInt(params.amount))\n .u16(params.royaltyMaxBps)\n .i64(BigInt(params.startTime))\n .i64(BigInt(params.endTime))\n .u64(counter);\n const order = orderPda(this.program, offerer, salt);\n const asset = new PublicKey(params.asset.contract);\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: offerer, isSigner: true, isWritable: true },\n { pubkey: order, isSigner: false, isWritable: true },\n { pubkey: counterPda(this.program, offerer), isSigner: false, isWritable: true },\n { pubkey: settlementPda(this.program), isSigner: false, isWritable: false },\n { pubkey: asset, isSigner: false, isWritable: true },\n { pubkey: new PublicKey(params.asset.tokenId), isSigner: false, isWritable: true },\n { pubkey: MPL_CORE_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(writer.build(instructionDiscriminator(\"register_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash, orderRef: order.toBase58() };\n }\n\n async fulfillOrder(): Promise<AdapterTxResult> {\n throw new Error(\n \"Solana fulfillment requires the order's creator remaining-accounts; use buildFulfillInstruction with explicit accounts\",\n );\n }\n\n async cancelOrder(signer: SolanaSigner, orderRef: OrderRef): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: false },\n { pubkey: new PublicKey(orderRef), isSigner: false, isWritable: true },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"cancel_order\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async incrementCounter(signer: SolanaSigner): Promise<AdapterTxResult> {\n const instruction = new TransactionInstruction({\n programId: this.program,\n keys: [\n { pubkey: signer.publicKey, isSigner: true, isWritable: true },\n { pubkey: counterPda(this.program, signer.publicKey), isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ],\n data: Buffer.from(new BorshWriter().build(instructionDiscriminator(\"increment_counter\"))),\n });\n const txHash = await this.send(signer, instruction);\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n const info = await this.connection.getAccountInfo(new PublicKey(orderRef));\n return info?.data ?? null;\n }\n\n async getCounter(address: string): Promise<bigint> {\n const pda = counterPda(this.program, new PublicKey(address));\n const info = await this.connection.getAccountInfo(pda);\n if (!info || info.data.length < 16) return 0n;\n // Anchor account: 8-byte discriminator + u64 count (LE).\n return new DataView(info.data.buffer, info.data.byteOffset + 8, 8).getBigUint64(0, true);\n }\n\n private async send(signer: SolanaSigner, instruction: TransactionInstruction): Promise<string> {\n const tx = new Transaction().add(instruction);\n tx.feePayer = signer.publicKey;\n tx.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash;\n const signed = await signer.signTransaction(tx);\n return this.connection.sendRawTransaction(signed.serialize());\n }\n}\n\nfunction maybeCoords(): SolanaCoordinates | undefined {\n try {\n return getCoordinates(\"SOLANA\");\n } catch {\n return undefined;\n }\n}\n"]}