@medialane/ui 0.220.0 → 0.222.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.
Files changed (142) hide show
  1. package/README.md +1 -1
  2. package/dist/components/account/email-code-entry.d.cts +1 -0
  3. package/dist/components/account/email-code-entry.d.ts +1 -0
  4. package/dist/components/account/input-otp.d.cts +2 -2
  5. package/dist/components/account/input-otp.d.ts +2 -2
  6. package/dist/components/button.d.cts +2 -2
  7. package/dist/components/button.d.ts +2 -2
  8. package/dist/components/creator-page.cjs +1 -1
  9. package/dist/components/creator-page.cjs.map +1 -1
  10. package/dist/components/creator-page.js +1 -1
  11. package/dist/components/creator-page.js.map +1 -1
  12. package/dist/components/fast-mint/fast-mint.cjs +8 -8
  13. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  14. package/dist/components/fast-mint/fast-mint.js +8 -8
  15. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  16. package/dist/components/license-request-page.cjs +11 -13
  17. package/dist/components/license-request-page.cjs.map +1 -1
  18. package/dist/components/license-request-page.js +11 -13
  19. package/dist/components/license-request-page.js.map +1 -1
  20. package/dist/components/media-wallet/media-wallet-activity.cjs +2 -2
  21. package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -1
  22. package/dist/components/media-wallet/media-wallet-activity.js +2 -2
  23. package/dist/components/media-wallet/media-wallet-activity.js.map +1 -1
  24. package/dist/components/media-wallet/media-wallet-send.cjs +1 -1
  25. package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -1
  26. package/dist/components/media-wallet/media-wallet-send.js +1 -1
  27. package/dist/components/media-wallet/media-wallet-send.js.map +1 -1
  28. package/dist/components/media-wallet/media-wallet-token-detail.cjs +1 -1
  29. package/dist/components/media-wallet/media-wallet-token-detail.cjs.map +1 -1
  30. package/dist/components/media-wallet/media-wallet-token-detail.js +1 -1
  31. package/dist/components/media-wallet/media-wallet-token-detail.js.map +1 -1
  32. package/dist/components/remix-browse-page.cjs +2 -5
  33. package/dist/components/remix-browse-page.cjs.map +1 -1
  34. package/dist/components/remix-browse-page.js +2 -5
  35. package/dist/components/remix-browse-page.js.map +1 -1
  36. package/dist/index.d.cts +2 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/utils/app-wallet.d.cts +5 -5
  39. package/dist/utils/app-wallet.d.ts +5 -5
  40. package/dist/utils/drop/actions.cjs +7 -7
  41. package/dist/utils/drop/actions.cjs.map +1 -1
  42. package/dist/utils/drop/actions.js +7 -7
  43. package/dist/utils/drop/actions.js.map +1 -1
  44. package/dist/utils/ipfs-upload.cjs +3 -3
  45. package/dist/utils/ipfs-upload.cjs.map +1 -1
  46. package/dist/utils/ipfs-upload.js +3 -3
  47. package/dist/utils/ipfs-upload.js.map +1 -1
  48. package/dist/utils/run-intent-calls.cjs +1 -1
  49. package/dist/utils/run-intent-calls.cjs.map +1 -1
  50. package/dist/utils/run-intent-calls.d.cts +1 -3
  51. package/dist/utils/run-intent-calls.d.ts +1 -3
  52. package/dist/utils/run-intent-calls.js +1 -1
  53. package/dist/utils/run-intent-calls.js.map +1 -1
  54. package/dist/utils/sitemap-data.cjs +3 -3
  55. package/dist/utils/sitemap-data.cjs.map +1 -1
  56. package/dist/utils/sitemap-data.js +3 -3
  57. package/dist/utils/sitemap-data.js.map +1 -1
  58. package/dist/utils/use-activities.cjs +2 -2
  59. package/dist/utils/use-activities.cjs.map +1 -1
  60. package/dist/utils/use-activities.js +2 -2
  61. package/dist/utils/use-activities.js.map +1 -1
  62. package/dist/utils/use-coin-price.cjs +1 -1
  63. package/dist/utils/use-coin-price.cjs.map +1 -1
  64. package/dist/utils/use-coin-price.js +1 -1
  65. package/dist/utils/use-coin-price.js.map +1 -1
  66. package/dist/utils/use-collections.cjs +5 -5
  67. package/dist/utils/use-collections.cjs.map +1 -1
  68. package/dist/utils/use-collections.d.cts +439 -9
  69. package/dist/utils/use-collections.d.ts +439 -9
  70. package/dist/utils/use-collections.js +5 -5
  71. package/dist/utils/use-collections.js.map +1 -1
  72. package/dist/utils/use-comments.cjs +1 -1
  73. package/dist/utils/use-comments.cjs.map +1 -1
  74. package/dist/utils/use-comments.js +1 -1
  75. package/dist/utils/use-comments.js.map +1 -1
  76. package/dist/utils/use-creators.cjs +1 -1
  77. package/dist/utils/use-creators.cjs.map +1 -1
  78. package/dist/utils/use-creators.js +1 -1
  79. package/dist/utils/use-creators.js.map +1 -1
  80. package/dist/utils/use-drops.cjs +7 -7
  81. package/dist/utils/use-drops.cjs.map +1 -1
  82. package/dist/utils/use-drops.js +7 -7
  83. package/dist/utils/use-drops.js.map +1 -1
  84. package/dist/utils/use-email-code.cjs.map +1 -1
  85. package/dist/utils/use-email-code.d.cts +2 -4
  86. package/dist/utils/use-email-code.d.ts +2 -4
  87. package/dist/utils/use-email-code.js.map +1 -1
  88. package/dist/utils/use-full-token-data.cjs +1 -1
  89. package/dist/utils/use-full-token-data.cjs.map +1 -1
  90. package/dist/utils/use-full-token-data.js +1 -1
  91. package/dist/utils/use-full-token-data.js.map +1 -1
  92. package/dist/utils/use-orders.cjs +8 -8
  93. package/dist/utils/use-orders.cjs.map +1 -1
  94. package/dist/utils/use-orders.d.cts +36 -36
  95. package/dist/utils/use-orders.d.ts +36 -36
  96. package/dist/utils/use-orders.js +8 -8
  97. package/dist/utils/use-orders.js.map +1 -1
  98. package/dist/utils/use-platform-stats.cjs +1 -1
  99. package/dist/utils/use-platform-stats.cjs.map +1 -1
  100. package/dist/utils/use-platform-stats.js +1 -1
  101. package/dist/utils/use-platform-stats.js.map +1 -1
  102. package/dist/utils/use-pop.cjs +2 -2
  103. package/dist/utils/use-pop.cjs.map +1 -1
  104. package/dist/utils/use-pop.d.cts +113 -4
  105. package/dist/utils/use-pop.d.ts +113 -4
  106. package/dist/utils/use-pop.js +2 -2
  107. package/dist/utils/use-pop.js.map +1 -1
  108. package/dist/utils/use-profiles.cjs +3 -3
  109. package/dist/utils/use-profiles.cjs.map +1 -1
  110. package/dist/utils/use-profiles.js +3 -3
  111. package/dist/utils/use-profiles.js.map +1 -1
  112. package/dist/utils/use-remix-offers.cjs +1 -1
  113. package/dist/utils/use-remix-offers.cjs.map +1 -1
  114. package/dist/utils/use-remix-offers.js +1 -1
  115. package/dist/utils/use-remix-offers.js.map +1 -1
  116. package/dist/utils/use-rewards.cjs +5 -5
  117. package/dist/utils/use-rewards.cjs.map +1 -1
  118. package/dist/utils/use-rewards.js +5 -5
  119. package/dist/utils/use-rewards.js.map +1 -1
  120. package/dist/utils/use-sponsorship.cjs +6 -6
  121. package/dist/utils/use-sponsorship.cjs.map +1 -1
  122. package/dist/utils/use-sponsorship.js +6 -6
  123. package/dist/utils/use-sponsorship.js.map +1 -1
  124. package/dist/utils/use-tiers.cjs +8 -8
  125. package/dist/utils/use-tiers.cjs.map +1 -1
  126. package/dist/utils/use-tiers.d.cts +150 -5
  127. package/dist/utils/use-tiers.d.ts +150 -5
  128. package/dist/utils/use-tiers.js +8 -8
  129. package/dist/utils/use-tiers.js.map +1 -1
  130. package/dist/utils/use-tokens-by-ip-type.cjs +1 -1
  131. package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -1
  132. package/dist/utils/use-tokens-by-ip-type.d.cts +170 -3
  133. package/dist/utils/use-tokens-by-ip-type.d.ts +170 -3
  134. package/dist/utils/use-tokens-by-ip-type.js +1 -1
  135. package/dist/utils/use-tokens-by-ip-type.js.map +1 -1
  136. package/dist/utils/use-tokens.cjs +7 -7
  137. package/dist/utils/use-tokens.cjs.map +1 -1
  138. package/dist/utils/use-tokens.d.cts +339 -7
  139. package/dist/utils/use-tokens.d.ts +339 -7
  140. package/dist/utils/use-tokens.js +7 -7
  141. package/dist/utils/use-tokens.js.map +1 -1
  142. package/package.json +3 -3
@@ -1,8 +1,45 @@
1
1
  import * as swr from 'swr';
2
- import { ApiCollection, ApiMeta } from '@medialane/sdk';
2
+ import * as zod from 'zod';
3
+ import { ApiMeta, ApiCollection } from '@medialane/sdk';
3
4
 
4
5
  declare function usePopCollections(): {
5
- collections: ApiCollection[];
6
+ collections: {
7
+ symbol: string | null;
8
+ chain: string;
9
+ owner: string | null;
10
+ collectionId: string | null;
11
+ name: string | null;
12
+ description: string | null;
13
+ image: string | null;
14
+ service: string | null;
15
+ contractAddress: string;
16
+ id: string;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
20
+ standard: "ERC721" | "ERC1155";
21
+ attributes: zod.objectOutputType<{
22
+ trait_type: zod.ZodString;
23
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
24
+ display_type: zod.ZodOptional<zod.ZodString>;
25
+ }, zod.ZodTypeAny, "passthrough">[] | null;
26
+ holderCount: number;
27
+ startBlock: string;
28
+ isFeatured: boolean;
29
+ isHidden: boolean;
30
+ claimedBy: string | null;
31
+ floorPrice: string | null;
32
+ totalVolume: string | null;
33
+ totalSupply: number;
34
+ profile: {
35
+ description: string | null;
36
+ image: string | null;
37
+ displayName: string | null;
38
+ gatedContentTitle: string | null;
39
+ hasGatedContent: boolean;
40
+ slug: string | null;
41
+ } | null;
42
+ }[];
6
43
  meta: ApiMeta | undefined;
7
44
  isLoading: boolean;
8
45
  error: any;
@@ -12,10 +49,82 @@ declare function usePopCollections(): {
12
49
  }>;
13
50
  };
14
51
  declare function useMyPopEvents(owner: string | null): {
15
- events: ApiCollection[];
52
+ events: {
53
+ symbol: string | null;
54
+ chain: string;
55
+ owner: string | null;
56
+ collectionId: string | null;
57
+ name: string | null;
58
+ description: string | null;
59
+ image: string | null;
60
+ service: string | null;
61
+ contractAddress: string;
62
+ id: string;
63
+ createdAt: string;
64
+ updatedAt: string;
65
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
66
+ standard: "ERC721" | "ERC1155";
67
+ attributes: zod.objectOutputType<{
68
+ trait_type: zod.ZodString;
69
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
70
+ display_type: zod.ZodOptional<zod.ZodString>;
71
+ }, zod.ZodTypeAny, "passthrough">[] | null;
72
+ holderCount: number;
73
+ startBlock: string;
74
+ isFeatured: boolean;
75
+ isHidden: boolean;
76
+ claimedBy: string | null;
77
+ floorPrice: string | null;
78
+ totalVolume: string | null;
79
+ totalSupply: number;
80
+ profile: {
81
+ description: string | null;
82
+ image: string | null;
83
+ displayName: string | null;
84
+ gatedContentTitle: string | null;
85
+ hasGatedContent: boolean;
86
+ slug: string | null;
87
+ } | null;
88
+ }[];
16
89
  isLoading: boolean;
17
90
  error: any;
18
- mutate: swr.KeyedMutator<ApiCollection[]>;
91
+ mutate: swr.KeyedMutator<{
92
+ symbol: string | null;
93
+ chain: string;
94
+ owner: string | null;
95
+ collectionId: string | null;
96
+ name: string | null;
97
+ description: string | null;
98
+ image: string | null;
99
+ service: string | null;
100
+ contractAddress: string;
101
+ id: string;
102
+ createdAt: string;
103
+ updatedAt: string;
104
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
105
+ standard: "ERC721" | "ERC1155";
106
+ attributes: zod.objectOutputType<{
107
+ trait_type: zod.ZodString;
108
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
109
+ display_type: zod.ZodOptional<zod.ZodString>;
110
+ }, zod.ZodTypeAny, "passthrough">[] | null;
111
+ holderCount: number;
112
+ startBlock: string;
113
+ isFeatured: boolean;
114
+ isHidden: boolean;
115
+ claimedBy: string | null;
116
+ floorPrice: string | null;
117
+ totalVolume: string | null;
118
+ totalSupply: number;
119
+ profile: {
120
+ description: string | null;
121
+ image: string | null;
122
+ displayName: string | null;
123
+ gatedContentTitle: string | null;
124
+ hasGatedContent: boolean;
125
+ slug: string | null;
126
+ } | null;
127
+ }[]>;
19
128
  };
20
129
  declare function popClaimedKey(collection: string | null, wallet: string | null): string | null;
21
130
  /** Whether `wallet` already holds this collection's credential, read from chain. */
@@ -1,8 +1,45 @@
1
1
  import * as swr from 'swr';
2
- import { ApiCollection, ApiMeta } from '@medialane/sdk';
2
+ import * as zod from 'zod';
3
+ import { ApiMeta, ApiCollection } from '@medialane/sdk';
3
4
 
4
5
  declare function usePopCollections(): {
5
- collections: ApiCollection[];
6
+ collections: {
7
+ symbol: string | null;
8
+ chain: string;
9
+ owner: string | null;
10
+ collectionId: string | null;
11
+ name: string | null;
12
+ description: string | null;
13
+ image: string | null;
14
+ service: string | null;
15
+ contractAddress: string;
16
+ id: string;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
20
+ standard: "ERC721" | "ERC1155";
21
+ attributes: zod.objectOutputType<{
22
+ trait_type: zod.ZodString;
23
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
24
+ display_type: zod.ZodOptional<zod.ZodString>;
25
+ }, zod.ZodTypeAny, "passthrough">[] | null;
26
+ holderCount: number;
27
+ startBlock: string;
28
+ isFeatured: boolean;
29
+ isHidden: boolean;
30
+ claimedBy: string | null;
31
+ floorPrice: string | null;
32
+ totalVolume: string | null;
33
+ totalSupply: number;
34
+ profile: {
35
+ description: string | null;
36
+ image: string | null;
37
+ displayName: string | null;
38
+ gatedContentTitle: string | null;
39
+ hasGatedContent: boolean;
40
+ slug: string | null;
41
+ } | null;
42
+ }[];
6
43
  meta: ApiMeta | undefined;
7
44
  isLoading: boolean;
8
45
  error: any;
@@ -12,10 +49,82 @@ declare function usePopCollections(): {
12
49
  }>;
13
50
  };
14
51
  declare function useMyPopEvents(owner: string | null): {
15
- events: ApiCollection[];
52
+ events: {
53
+ symbol: string | null;
54
+ chain: string;
55
+ owner: string | null;
56
+ collectionId: string | null;
57
+ name: string | null;
58
+ description: string | null;
59
+ image: string | null;
60
+ service: string | null;
61
+ contractAddress: string;
62
+ id: string;
63
+ createdAt: string;
64
+ updatedAt: string;
65
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
66
+ standard: "ERC721" | "ERC1155";
67
+ attributes: zod.objectOutputType<{
68
+ trait_type: zod.ZodString;
69
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
70
+ display_type: zod.ZodOptional<zod.ZodString>;
71
+ }, zod.ZodTypeAny, "passthrough">[] | null;
72
+ holderCount: number;
73
+ startBlock: string;
74
+ isFeatured: boolean;
75
+ isHidden: boolean;
76
+ claimedBy: string | null;
77
+ floorPrice: string | null;
78
+ totalVolume: string | null;
79
+ totalSupply: number;
80
+ profile: {
81
+ description: string | null;
82
+ image: string | null;
83
+ displayName: string | null;
84
+ gatedContentTitle: string | null;
85
+ hasGatedContent: boolean;
86
+ slug: string | null;
87
+ } | null;
88
+ }[];
16
89
  isLoading: boolean;
17
90
  error: any;
18
- mutate: swr.KeyedMutator<ApiCollection[]>;
91
+ mutate: swr.KeyedMutator<{
92
+ symbol: string | null;
93
+ chain: string;
94
+ owner: string | null;
95
+ collectionId: string | null;
96
+ name: string | null;
97
+ description: string | null;
98
+ image: string | null;
99
+ service: string | null;
100
+ contractAddress: string;
101
+ id: string;
102
+ createdAt: string;
103
+ updatedAt: string;
104
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
105
+ standard: "ERC721" | "ERC1155";
106
+ attributes: zod.objectOutputType<{
107
+ trait_type: zod.ZodString;
108
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
109
+ display_type: zod.ZodOptional<zod.ZodString>;
110
+ }, zod.ZodTypeAny, "passthrough">[] | null;
111
+ holderCount: number;
112
+ startBlock: string;
113
+ isFeatured: boolean;
114
+ isHidden: boolean;
115
+ claimedBy: string | null;
116
+ floorPrice: string | null;
117
+ totalVolume: string | null;
118
+ totalSupply: number;
119
+ profile: {
120
+ description: string | null;
121
+ image: string | null;
122
+ displayName: string | null;
123
+ gatedContentTitle: string | null;
124
+ hasGatedContent: boolean;
125
+ slug: string | null;
126
+ } | null;
127
+ }[]>;
19
128
  };
20
129
  declare function popClaimedKey(collection: string | null, wallet: string | null): string | null;
21
130
  /** Whether `wallet` already holds this collection's credential, read from chain. */
@@ -6,7 +6,7 @@ function usePopCollections() {
6
6
  const client = useMedialaneClient();
7
7
  const { data, error, isLoading, mutate } = useSWR(
8
8
  "pop-collections",
9
- () => client.api.listCollections({ service: "pop-protocol", hideEmpty: false, limit: 50 }),
9
+ () => client.api.collections.list({ service: "pop-protocol", hideEmpty: false, limit: 50 }),
10
10
  { revalidateOnFocus: false }
11
11
  );
12
12
  return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
@@ -15,7 +15,7 @@ function useMyPopEvents(owner) {
15
15
  const client = useMedialaneClient();
16
16
  const { data, error, isLoading, mutate } = useSWR(
17
17
  owner ? `my-pop-events-${owner}` : null,
18
- async () => (await client.api.listCollections({ service: "pop-protocol", owner, limit: 50 })).data ?? [],
18
+ async () => (await client.api.collections.list({ service: "pop-protocol", owner, limit: 50 })).data ?? [],
19
19
  { revalidateOnFocus: false }
20
20
  );
21
21
  return { events: data ?? [], isLoading, error, mutate };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta } from \"@medialane/sdk\";\nimport { popHasClaimed } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections() {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.listCollections({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents( owner: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function popClaimedKey(collection: string | null, wallet: string | null): string | null {\n return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;\n}\n\n/** Whether `wallet` already holds this collection's credential, read from chain. */\nexport function usePopClaimStatus(\n collection: string | null,\n wallet: string | null,\n) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<boolean>(\n popClaimedKey(collection, wallet),\n () => popHasClaimed(client.provider, collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false },\n );\n return { hasClaimed: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAE5B,SAAS,oBAAoB;AAClC,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IACzF,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,eAAgB,OAAsB;AACpD,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,QAAQ,iBAAiB,KAAK,KAAK;AAAA,IACnC,aAAa,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAC/G,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACxD;AAEO,SAAS,cAAc,YAA2B,QAAsC;AAC7F,SAAO,cAAc,SAAS,eAAe,UAAU,IAAI,MAAM,KAAK;AACxE;AAGO,SAAS,kBACd,YACA,QACA;AACA,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,cAAc,YAAY,MAAM;AAAA,IAChC,MAAM,cAAc,OAAO,UAAU,YAAa,MAAO;AAAA,IACzD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC9D;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta } from \"@medialane/sdk\";\nimport { popHasClaimed } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections() {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.collections.list({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents( owner: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.collections.list({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function popClaimedKey(collection: string | null, wallet: string | null): string | null {\n return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;\n}\n\n/** Whether `wallet` already holds this collection's credential, read from chain. */\nexport function usePopClaimStatus(\n collection: string | null,\n wallet: string | null,\n) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<boolean>(\n popClaimedKey(collection, wallet),\n () => popHasClaimed(client.provider, collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false },\n );\n return { hasClaimed: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAE5B,SAAS,oBAAoB;AAClC,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,YAAY,KAAK,EAAE,SAAS,gBAAgB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IAC1F,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,eAAgB,OAAsB;AACpD,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,QAAQ,iBAAiB,KAAK,KAAK;AAAA,IACnC,aAAa,MAAM,OAAO,IAAI,YAAY,KAAK,EAAE,SAAS,gBAAgB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAChH,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACxD;AAEO,SAAS,cAAc,YAA2B,QAAsC;AAC7F,SAAO,cAAc,SAAS,eAAe,UAAU,IAAI,MAAM,KAAK;AACxE;AAGO,SAAS,kBACd,YACA,QACA;AACA,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,cAAc,YAAY,MAAM;AAAA,IAChC,MAAM,cAAc,OAAO,UAAU,YAAa,MAAO;AAAA,IACzD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC9D;","names":[]}
@@ -40,7 +40,7 @@ function useCollectionProfile(contractAddress) {
40
40
  const { getClient } = (0, import_medialane_app.useMedialaneApp)();
41
41
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
42
42
  contractAddress ? `profile-collection-${contractAddress}` : null,
43
- () => getClient().api.getCollectionProfile(contractAddress),
43
+ () => getClient().api.collections.findProfile(contractAddress),
44
44
  { revalidateOnFocus: false }
45
45
  );
46
46
  return { profile: data ?? null, isLoading, error, mutate };
@@ -51,7 +51,7 @@ function useCreatorProfile(walletAddress) {
51
51
  walletAddress ? `profile-creator-${walletAddress}` : null,
52
52
  async () => {
53
53
  try {
54
- return await getClient().api.getCreatorProfile(walletAddress);
54
+ return await getClient().api.creators.findProfile(walletAddress);
55
55
  } catch (e) {
56
56
  const msg = e instanceof Error ? e.message : "";
57
57
  const status = e?.status;
@@ -69,7 +69,7 @@ function useCreatorByUsername(username) {
69
69
  const { getClient } = (0, import_medialane_app.useMedialaneApp)();
70
70
  const { data, error, isLoading } = (0, import_swr.default)(
71
71
  username ? `creator-by-username-${username}` : null,
72
- () => getClient().api.getCreatorByUsername(username),
72
+ () => getClient().api.creators.findByUsername(username),
73
73
  { revalidateOnFocus: false, revalidateOnMount: true }
74
74
  );
75
75
  return { creator: data ?? null, isLoading, error };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-profiles.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport function useCollectionProfile( contractAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n contractAddress ? `profile-collection-${contractAddress}` : null,\n () => getClient().api.getCollectionProfile(contractAddress!),\n { revalidateOnFocus: false }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorProfile( walletAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n walletAddress ? `profile-creator-${walletAddress}` : null,\n async () => {\n try {\n return await getClient().api.getCreatorProfile(walletAddress!);\n } catch (e: unknown) {\n\n const msg = e instanceof Error ? e.message : \"\";\n const status = (e as { status?: number })?.status;\n if (msg.includes(\"404\") || msg.includes(\"Not Found\") || status === 404) {\n return null;\n }\n throw e;\n }\n },\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorByUsername(username: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading } = useSWR(\n username ? `creator-by-username-${username}` : null,\n () => getClient().api.getCreatorByUsername(username!),\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { creator: data ?? null, isLoading, error };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,2BAAgC;AAEzB,SAAS,qBAAsB,iBAAqC;AACzE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,kBAAkB,sBAAsB,eAAe,KAAK;AAAA,IAC5D,MAAM,UAAU,EAAE,IAAI,qBAAqB,eAAgB;AAAA,IAC3D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,kBAAmB,eAAmC;AACpE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,gBAAgB,mBAAmB,aAAa,KAAK;AAAA,IACrD,YAAY;AACV,UAAI;AACF,eAAO,MAAM,UAAU,EAAE,IAAI,kBAAkB,aAAc;AAAA,MAC/D,SAAS,GAAY;AAEnB,cAAM,MAAM,aAAa,QAAQ,EAAE,UAAU;AAC7C,cAAM,SAAU,GAA2B;AAC3C,YAAI,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,WAAW,KAAK,WAAW,KAAK;AACtE,iBAAO;AAAA,QACT;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,qBAAqB,UAAqC;AACxE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,WAAW,uBAAuB,QAAQ,KAAK;AAAA,IAC/C,MAAM,UAAU,EAAE,IAAI,qBAAqB,QAAS;AAAA,IACpD,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,MAAM;AACnD;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-profiles.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport function useCollectionProfile( contractAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n contractAddress ? `profile-collection-${contractAddress}` : null,\n () => getClient().api.collections.findProfile(contractAddress!),\n { revalidateOnFocus: false }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorProfile( walletAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n walletAddress ? `profile-creator-${walletAddress}` : null,\n async () => {\n try {\n return await getClient().api.creators.findProfile(walletAddress!);\n } catch (e: unknown) {\n\n const msg = e instanceof Error ? e.message : \"\";\n const status = (e as { status?: number })?.status;\n if (msg.includes(\"404\") || msg.includes(\"Not Found\") || status === 404) {\n return null;\n }\n throw e;\n }\n },\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorByUsername(username: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading } = useSWR(\n username ? `creator-by-username-${username}` : null,\n () => getClient().api.creators.findByUsername(username!),\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { creator: data ?? null, isLoading, error };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,2BAAgC;AAEzB,SAAS,qBAAsB,iBAAqC;AACzE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,kBAAkB,sBAAsB,eAAe,KAAK;AAAA,IAC5D,MAAM,UAAU,EAAE,IAAI,YAAY,YAAY,eAAgB;AAAA,IAC9D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,kBAAmB,eAAmC;AACpE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,gBAAgB,mBAAmB,aAAa,KAAK;AAAA,IACrD,YAAY;AACV,UAAI;AACF,eAAO,MAAM,UAAU,EAAE,IAAI,SAAS,YAAY,aAAc;AAAA,MAClE,SAAS,GAAY;AAEnB,cAAM,MAAM,aAAa,QAAQ,EAAE,UAAU;AAC7C,cAAM,SAAU,GAA2B;AAC3C,YAAI,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,WAAW,KAAK,WAAW,KAAK;AACtE,iBAAO;AAAA,QACT;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,qBAAqB,UAAqC;AACxE,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,WAAW,uBAAuB,QAAQ,KAAK;AAAA,IAC/C,MAAM,UAAU,EAAE,IAAI,SAAS,eAAe,QAAS;AAAA,IACvD,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,MAAM;AACnD;","names":["useSWR"]}
@@ -5,7 +5,7 @@ function useCollectionProfile(contractAddress) {
5
5
  const { getClient } = useMedialaneApp();
6
6
  const { data, error, isLoading, mutate } = useSWR(
7
7
  contractAddress ? `profile-collection-${contractAddress}` : null,
8
- () => getClient().api.getCollectionProfile(contractAddress),
8
+ () => getClient().api.collections.findProfile(contractAddress),
9
9
  { revalidateOnFocus: false }
10
10
  );
11
11
  return { profile: data ?? null, isLoading, error, mutate };
@@ -16,7 +16,7 @@ function useCreatorProfile(walletAddress) {
16
16
  walletAddress ? `profile-creator-${walletAddress}` : null,
17
17
  async () => {
18
18
  try {
19
- return await getClient().api.getCreatorProfile(walletAddress);
19
+ return await getClient().api.creators.findProfile(walletAddress);
20
20
  } catch (e) {
21
21
  const msg = e instanceof Error ? e.message : "";
22
22
  const status = e?.status;
@@ -34,7 +34,7 @@ function useCreatorByUsername(username) {
34
34
  const { getClient } = useMedialaneApp();
35
35
  const { data, error, isLoading } = useSWR(
36
36
  username ? `creator-by-username-${username}` : null,
37
- () => getClient().api.getCreatorByUsername(username),
37
+ () => getClient().api.creators.findByUsername(username),
38
38
  { revalidateOnFocus: false, revalidateOnMount: true }
39
39
  );
40
40
  return { creator: data ?? null, isLoading, error };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-profiles.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport function useCollectionProfile( contractAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n contractAddress ? `profile-collection-${contractAddress}` : null,\n () => getClient().api.getCollectionProfile(contractAddress!),\n { revalidateOnFocus: false }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorProfile( walletAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n walletAddress ? `profile-creator-${walletAddress}` : null,\n async () => {\n try {\n return await getClient().api.getCreatorProfile(walletAddress!);\n } catch (e: unknown) {\n\n const msg = e instanceof Error ? e.message : \"\";\n const status = (e as { status?: number })?.status;\n if (msg.includes(\"404\") || msg.includes(\"Not Found\") || status === 404) {\n return null;\n }\n throw e;\n }\n },\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorByUsername(username: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading } = useSWR(\n username ? `creator-by-username-${username}` : null,\n () => getClient().api.getCreatorByUsername(username!),\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { creator: data ?? null, isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,uBAAuB;AAEzB,SAAS,qBAAsB,iBAAqC;AACzE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,kBAAkB,sBAAsB,eAAe,KAAK;AAAA,IAC5D,MAAM,UAAU,EAAE,IAAI,qBAAqB,eAAgB;AAAA,IAC3D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,kBAAmB,eAAmC;AACpE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,gBAAgB,mBAAmB,aAAa,KAAK;AAAA,IACrD,YAAY;AACV,UAAI;AACF,eAAO,MAAM,UAAU,EAAE,IAAI,kBAAkB,aAAc;AAAA,MAC/D,SAAS,GAAY;AAEnB,cAAM,MAAM,aAAa,QAAQ,EAAE,UAAU;AAC7C,cAAM,SAAU,GAA2B;AAC3C,YAAI,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,WAAW,KAAK,WAAW,KAAK;AACtE,iBAAO;AAAA,QACT;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,qBAAqB,UAAqC;AACxE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,WAAW,uBAAuB,QAAQ,KAAK;AAAA,IAC/C,MAAM,UAAU,EAAE,IAAI,qBAAqB,QAAS;AAAA,IACpD,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,MAAM;AACnD;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-profiles.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport function useCollectionProfile( contractAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n contractAddress ? `profile-collection-${contractAddress}` : null,\n () => getClient().api.collections.findProfile(contractAddress!),\n { revalidateOnFocus: false }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorProfile( walletAddress: string | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading, mutate } = useSWR(\n walletAddress ? `profile-creator-${walletAddress}` : null,\n async () => {\n try {\n return await getClient().api.creators.findProfile(walletAddress!);\n } catch (e: unknown) {\n\n const msg = e instanceof Error ? e.message : \"\";\n const status = (e as { status?: number })?.status;\n if (msg.includes(\"404\") || msg.includes(\"Not Found\") || status === 404) {\n return null;\n }\n throw e;\n }\n },\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { profile: data ?? null, isLoading, error, mutate };\n}\n\nexport function useCreatorByUsername(username: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n const { data, error, isLoading } = useSWR(\n username ? `creator-by-username-${username}` : null,\n () => getClient().api.creators.findByUsername(username!),\n { revalidateOnFocus: false, revalidateOnMount: true }\n );\n return { creator: data ?? null, isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,uBAAuB;AAEzB,SAAS,qBAAsB,iBAAqC;AACzE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,kBAAkB,sBAAsB,eAAe,KAAK;AAAA,IAC5D,MAAM,UAAU,EAAE,IAAI,YAAY,YAAY,eAAgB;AAAA,IAC9D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,kBAAmB,eAAmC;AACpE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,gBAAgB,mBAAmB,aAAa,KAAK;AAAA,IACrD,YAAY;AACV,UAAI;AACF,eAAO,MAAM,UAAU,EAAE,IAAI,SAAS,YAAY,aAAc;AAAA,MAClE,SAAS,GAAY;AAEnB,cAAM,MAAM,aAAa,QAAQ,EAAE,UAAU;AAC7C,cAAM,SAAU,GAA2B;AAC3C,YAAI,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,WAAW,KAAK,WAAW,KAAK;AACtE,iBAAO;AAAA,QACT;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC3D;AAEO,SAAS,qBAAqB,UAAqC;AACxE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,WAAW,uBAAuB,QAAQ,KAAK;AAAA,IAC/C,MAAM,UAAU,EAAE,IAAI,SAAS,eAAe,QAAS;AAAA,IACvD,EAAE,mBAAmB,OAAO,mBAAmB,KAAK;AAAA,EACtD;AACA,SAAO,EAAE,SAAS,QAAQ,MAAM,WAAW,MAAM;AACnD;","names":[]}
@@ -38,7 +38,7 @@ function useTokenRemixes(contract, tokenId) {
38
38
  const client = (0, import_use_medialane_client.useMedialaneClient)();
39
39
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
40
40
  contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,
41
- () => client.api.getTokenRemixes(contract, tokenId),
41
+ () => client.api.tokens.remixes(contract, tokenId),
42
42
  { refreshInterval: 6e4, revalidateOnFocus: false }
43
43
  );
44
44
  return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { ApiPublicRemix, ApiResponse } from \"@medialane/sdk\";\n\nexport function useTokenRemixes( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiPublicRemix[]>>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => client.api.getTokenRemixes(contract!, tokenId!),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,kCAAmC;AAG5B,SAAS,gBAAiB,UAAyB,SAAwB;AAChF,QAAM,aAAS,gDAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,MAAM,OAAO,IAAI,gBAAgB,UAAW,OAAQ;AAAA,IACpD,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,MAAM,SAAS,GAAG,WAAW,OAAO,OAAO;AAC9F;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { ApiPublicRemix, ApiResponse } from \"@medialane/sdk\";\n\nexport function useTokenRemixes( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiPublicRemix[]>>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => client.api.tokens.remixes(contract!, tokenId!),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,kCAAmC;AAG5B,SAAS,gBAAiB,UAAyB,SAAwB;AAChF,QAAM,aAAS,gDAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,MAAM,OAAO,IAAI,OAAO,QAAQ,UAAW,OAAQ;AAAA,IACnD,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,MAAM,SAAS,GAAG,WAAW,OAAO,OAAO;AAC9F;","names":["useSWR"]}
@@ -5,7 +5,7 @@ function useTokenRemixes(contract, tokenId) {
5
5
  const client = useMedialaneClient();
6
6
  const { data, error, isLoading, mutate } = useSWR(
7
7
  contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,
8
- () => client.api.getTokenRemixes(contract, tokenId),
8
+ () => client.api.tokens.remixes(contract, tokenId),
9
9
  { refreshInterval: 6e4, revalidateOnFocus: false }
10
10
  );
11
11
  return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { ApiPublicRemix, ApiResponse } from \"@medialane/sdk\";\n\nexport function useTokenRemixes( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiPublicRemix[]>>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => client.api.getTokenRemixes(contract!, tokenId!),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,0BAA0B;AAG5B,SAAS,gBAAiB,UAAyB,SAAwB;AAChF,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,MAAM,OAAO,IAAI,gBAAgB,UAAW,OAAQ;AAAA,IACpD,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,MAAM,SAAS,GAAG,WAAW,OAAO,OAAO;AAC9F;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { ApiPublicRemix, ApiResponse } from \"@medialane/sdk\";\n\nexport function useTokenRemixes( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiPublicRemix[]>>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => client.api.tokens.remixes(contract!, tokenId!),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,0BAA0B;AAG5B,SAAS,gBAAiB,UAAyB,SAAwB;AAChF,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,MAAM,OAAO,IAAI,OAAO,QAAQ,UAAW,OAAQ;AAAA,IACnD,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,MAAM,SAAS,GAAG,WAAW,OAAO,OAAO;AAC9F;","names":[]}
@@ -42,7 +42,7 @@ function useRewards(address) {
42
42
  const { getClient } = (0, import_medialane_app.useMedialaneApp)();
43
43
  return (0, import_swr.default)(
44
44
  address ? `rewards:${address}` : null,
45
- () => getClient().api.getRewards(address),
45
+ () => getClient().api.rewards.get(address),
46
46
  { revalidateOnFocus: false, dedupingInterval: 6e4 }
47
47
  );
48
48
  }
@@ -51,7 +51,7 @@ function useLeaderboard(page = 1, limit = 50) {
51
51
  return (0, import_swr.default)(
52
52
  `rewards-leaderboard:${page}:${limit}`,
53
53
  async () => {
54
- const res = await getClient().api.getRewardsLeaderboard(page, limit);
54
+ const res = await getClient().api.rewards.leaderboard({ page, limit });
55
55
  return {
56
56
  data: res.data,
57
57
  meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length }
@@ -65,7 +65,7 @@ function useRewardsEvents(address, page = 1, limit = 20) {
65
65
  return (0, import_swr.default)(
66
66
  address ? `rewards-events:${address}:${page}:${limit}` : null,
67
67
  async () => {
68
- const res = await getClient().api.getRewardsEvents(address, page, limit);
68
+ const res = await getClient().api.rewards.events(address, { page, limit });
69
69
  return {
70
70
  data: res.data,
71
71
  meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length }
@@ -78,7 +78,7 @@ function useRewardsConfig() {
78
78
  const { getClient } = (0, import_medialane_app.useMedialaneApp)();
79
79
  return (0, import_swr.default)(
80
80
  "rewards-config",
81
- () => getClient().api.getRewardsConfig(),
81
+ () => getClient().api.rewards.config(),
82
82
  { revalidateOnFocus: false, dedupingInterval: 3e5 }
83
83
  );
84
84
  }
@@ -89,7 +89,7 @@ function useRewardsBatch(addresses) {
89
89
  return (0, import_swr.default)(
90
90
  key,
91
91
  async () => {
92
- const entries = await getClient().api.getRewardsBatch(unique);
92
+ const entries = await getClient().api.rewards.batch(unique);
93
93
  return new Map(entries.map((e) => [e.address, e]));
94
94
  },
95
95
  { revalidateOnFocus: false, dedupingInterval: 12e4 }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards( address: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.getRewards(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard( page = 1, limit = 50) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.getRewardsLeaderboard(page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.getRewardsEvents(address!, page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig() {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.getRewardsConfig(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch( addresses: string[]) {\n const { getClient } = useMedialaneApp();\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.getRewardsBatch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAQnB,2BAAgC;AAOzB,SAAS,WAAY,SAAoC;AAC9D,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,UAAU,WAAW,OAAO,KAAK;AAAA,IACjC,MAAM,UAAU,EAAE,IAAI,WAAW,OAAQ;AAAA,IACzC,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,eAAgB,OAAO,GAAG,QAAQ,IAAI;AACpD,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,uBAAuB,IAAI,IAAI,KAAK;AAAA,IACpC,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,sBAAsB,MAAM,KAAK;AACnE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;AAEO,SAAS,iBACd,SACA,OAAO,GACP,QAAQ,IACR;AACA,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,UAAU,kBAAkB,OAAO,IAAI,IAAI,IAAI,KAAK,KAAK;AAAA,IACzD,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,iBAAiB,SAAU,MAAM,KAAK;AACxE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,mBAAmB;AACjC,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL;AAAA,IACA,MAAM,UAAU,EAAE,IAAI,iBAAiB;AAAA,IACvC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAiB,WAAqB;AACpD,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,aAAO,WAAAA;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,gBAAgB,MAAM;AAC5D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards( address: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.rewards.get(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard( page = 1, limit = 50) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.rewards.leaderboard({ page: page, limit: limit });\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.rewards.events(address!, { page: page, limit: limit });\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig() {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.rewards.config(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch( addresses: string[]) {\n const { getClient } = useMedialaneApp();\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.rewards.batch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAQnB,2BAAgC;AAOzB,SAAS,WAAY,SAAoC;AAC9D,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,UAAU,WAAW,OAAO,KAAK;AAAA,IACjC,MAAM,UAAU,EAAE,IAAI,QAAQ,IAAI,OAAQ;AAAA,IAC1C,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,eAAgB,OAAO,GAAG,QAAQ,IAAI;AACpD,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,uBAAuB,IAAI,IAAI,KAAK;AAAA,IACpC,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,QAAQ,YAAY,EAAE,MAAY,MAAa,CAAC;AAClF,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;AAEO,SAAS,iBACd,SACA,OAAO,GACP,QAAQ,IACR;AACA,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL,UAAU,kBAAkB,OAAO,IAAI,IAAI,IAAI,KAAK,KAAK;AAAA,IACzD,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,QAAQ,OAAO,SAAU,EAAE,MAAY,MAAa,CAAC;AACvF,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,mBAAmB;AACjC,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,aAAO,WAAAA;AAAA,IACL;AAAA,IACA,MAAM,UAAU,EAAE,IAAI,QAAQ,OAAO;AAAA,IACrC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAiB,WAAqB;AACpD,QAAM,EAAE,UAAU,QAAI,sCAAgB;AACtC,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,aAAO,WAAAA;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,QAAQ,MAAM,MAAM;AAC1D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":["useSWR"]}
@@ -5,7 +5,7 @@ function useRewards(address) {
5
5
  const { getClient } = useMedialaneApp();
6
6
  return useSWR(
7
7
  address ? `rewards:${address}` : null,
8
- () => getClient().api.getRewards(address),
8
+ () => getClient().api.rewards.get(address),
9
9
  { revalidateOnFocus: false, dedupingInterval: 6e4 }
10
10
  );
11
11
  }
@@ -14,7 +14,7 @@ function useLeaderboard(page = 1, limit = 50) {
14
14
  return useSWR(
15
15
  `rewards-leaderboard:${page}:${limit}`,
16
16
  async () => {
17
- const res = await getClient().api.getRewardsLeaderboard(page, limit);
17
+ const res = await getClient().api.rewards.leaderboard({ page, limit });
18
18
  return {
19
19
  data: res.data,
20
20
  meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length }
@@ -28,7 +28,7 @@ function useRewardsEvents(address, page = 1, limit = 20) {
28
28
  return useSWR(
29
29
  address ? `rewards-events:${address}:${page}:${limit}` : null,
30
30
  async () => {
31
- const res = await getClient().api.getRewardsEvents(address, page, limit);
31
+ const res = await getClient().api.rewards.events(address, { page, limit });
32
32
  return {
33
33
  data: res.data,
34
34
  meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length }
@@ -41,7 +41,7 @@ function useRewardsConfig() {
41
41
  const { getClient } = useMedialaneApp();
42
42
  return useSWR(
43
43
  "rewards-config",
44
- () => getClient().api.getRewardsConfig(),
44
+ () => getClient().api.rewards.config(),
45
45
  { revalidateOnFocus: false, dedupingInterval: 3e5 }
46
46
  );
47
47
  }
@@ -52,7 +52,7 @@ function useRewardsBatch(addresses) {
52
52
  return useSWR(
53
53
  key,
54
54
  async () => {
55
- const entries = await getClient().api.getRewardsBatch(unique);
55
+ const entries = await getClient().api.rewards.batch(unique);
56
56
  return new Map(entries.map((e) => [e.address, e]));
57
57
  },
58
58
  { revalidateOnFocus: false, dedupingInterval: 12e4 }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards( address: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.getRewards(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard( page = 1, limit = 50) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.getRewardsLeaderboard(page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.getRewardsEvents(address!, page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig() {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.getRewardsConfig(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch( addresses: string[]) {\n const { getClient } = useMedialaneApp();\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.getRewardsBatch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAQnB,SAAS,uBAAuB;AAOzB,SAAS,WAAY,SAAoC;AAC9D,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,UAAU,WAAW,OAAO,KAAK;AAAA,IACjC,MAAM,UAAU,EAAE,IAAI,WAAW,OAAQ;AAAA,IACzC,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,eAAgB,OAAO,GAAG,QAAQ,IAAI;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,uBAAuB,IAAI,IAAI,KAAK;AAAA,IACpC,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,sBAAsB,MAAM,KAAK;AACnE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;AAEO,SAAS,iBACd,SACA,OAAO,GACP,QAAQ,IACR;AACA,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,UAAU,kBAAkB,OAAO,IAAI,IAAI,IAAI,KAAK,KAAK;AAAA,IACzD,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,iBAAiB,SAAU,MAAM,KAAK;AACxE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,mBAAmB;AACjC,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL;AAAA,IACA,MAAM,UAAU,EAAE,IAAI,iBAAiB;AAAA,IACvC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAiB,WAAqB;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,gBAAgB,MAAM;AAC5D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards( address: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.rewards.get(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard( page = 1, limit = 50) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.rewards.leaderboard({ page: page, limit: limit });\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.rewards.events(address!, { page: page, limit: limit });\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig() {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.rewards.config(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch( addresses: string[]) {\n const { getClient } = useMedialaneApp();\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.rewards.batch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAQnB,SAAS,uBAAuB;AAOzB,SAAS,WAAY,SAAoC;AAC9D,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,UAAU,WAAW,OAAO,KAAK;AAAA,IACjC,MAAM,UAAU,EAAE,IAAI,QAAQ,IAAI,OAAQ;AAAA,IAC1C,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,eAAgB,OAAO,GAAG,QAAQ,IAAI;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,uBAAuB,IAAI,IAAI,KAAK;AAAA,IACpC,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,QAAQ,YAAY,EAAE,MAAY,MAAa,CAAC;AAClF,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;AAEO,SAAS,iBACd,SACA,OAAO,GACP,QAAQ,IACR;AACA,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL,UAAU,kBAAkB,OAAO,IAAI,IAAI,IAAI,KAAK,KAAK;AAAA,IACzD,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,QAAQ,OAAO,SAAU,EAAE,MAAY,MAAa,CAAC;AACvF,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,mBAAmB;AACjC,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,SAAO;AAAA,IACL;AAAA,IACA,MAAM,UAAU,EAAE,IAAI,QAAQ,OAAO;AAAA,IACrC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAiB,WAAqB;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,QAAQ,MAAM,MAAM;AAC1D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":[]}
@@ -46,7 +46,7 @@ function useSponsorshipOffers(params) {
46
46
  const client = (0, import_use_medialane_client.useMedialaneClient)();
47
47
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
48
48
  key,
49
- () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),
49
+ () => client.api.sponsorship.offers({ ...params, limit: 50 }),
50
50
  { revalidateOnFocus: false }
51
51
  );
52
52
  return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
@@ -55,7 +55,7 @@ function useSponsorshipOffer(offerId) {
55
55
  const client = (0, import_use_medialane_client.useMedialaneClient)();
56
56
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
57
57
  offerId ? `sponsorship-offer-${offerId}` : null,
58
- () => client.api.getSponsorshipOffer(offerId),
58
+ () => client.api.sponsorship.findOffer(offerId),
59
59
  { revalidateOnFocus: false }
60
60
  );
61
61
  return { offer: data ?? null, isLoading, error, mutate };
@@ -64,7 +64,7 @@ function useSponsorshipBids(offerId) {
64
64
  const client = (0, import_use_medialane_client.useMedialaneClient)();
65
65
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
66
66
  offerId ? `sponsorship-bids-${offerId}` : null,
67
- () => client.api.getSponsorshipBids(offerId),
67
+ () => client.api.sponsorship.bids(offerId),
68
68
  { revalidateOnFocus: false }
69
69
  );
70
70
  return { bids: data ?? [], isLoading, error, mutate };
@@ -74,7 +74,7 @@ function useSponsorshipProposals(params) {
74
74
  const client = (0, import_use_medialane_client.useMedialaneClient)();
75
75
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
76
76
  key,
77
- () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),
77
+ () => client.api.sponsorship.proposals({ ...params, limit: 50 }),
78
78
  { revalidateOnFocus: false }
79
79
  );
80
80
  return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
@@ -83,7 +83,7 @@ function useSponsorshipProposal(proposalId) {
83
83
  const client = (0, import_use_medialane_client.useMedialaneClient)();
84
84
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
85
85
  proposalId ? `sponsorship-proposal-${proposalId}` : null,
86
- () => client.api.getSponsorshipProposal(proposalId),
86
+ () => client.api.sponsorship.findProposal(proposalId),
87
87
  { revalidateOnFocus: false }
88
88
  );
89
89
  return { proposal: data ?? null, isLoading, error, mutate };
@@ -99,7 +99,7 @@ function useSponsorshipLicenses(params) {
99
99
  const client = (0, import_use_medialane_client.useMedialaneClient)();
100
100
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
101
101
  key,
102
- () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),
102
+ () => client.api.sponsorship.licenses({ ...params, limit: 50 }),
103
103
  { revalidateOnFocus: false }
104
104
  );
105
105
  return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };