@medialane/sdk 0.152.0 → 0.153.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -510,6 +510,7 @@ without reaching a reader.
510
510
  | `rpcUrl` | `string` | the chain's registry `rpcUrl` | JSON-RPC URL override |
511
511
  | `backendUrl` | `string` | (none) | Medialane API base URL (required for `.api.*`) |
512
512
  | `apiKey` | `string` | (none) | API key from [Medialane Portal](https://portal.medialane.io) |
513
+ | `appSource` | `string` | (none) | The registered name of your app (upper case, for example `MEDIALANE_IO`). Sent as `x-app-source` on every request, so sign-ups and sign-ins are recorded under your app |
513
514
  | `marketplace721Contract` | `string` | Mainnet default | ERC-721 marketplace protocol override |
514
515
  | `marketplaceContract` | `string` | Mainnet default | Legacy alias for `marketplace721Contract` |
515
516
  | `marketplace1155Contract` | `string` | Mainnet default | ERC-1155 marketplace protocol override |
@@ -42,6 +42,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
42
42
  rpcUrl: z.ZodOptional<z.ZodString>;
43
43
  backendUrl: z.ZodOptional<z.ZodString>;
44
44
  apiKey: z.ZodOptional<z.ZodString>;
45
+ appSource: z.ZodOptional<z.ZodString>;
45
46
  marketplace721Contract: z.ZodOptional<z.ZodString>;
46
47
  marketplaceContract: z.ZodOptional<z.ZodString>;
47
48
  marketplace1155Contract: z.ZodOptional<z.ZodString>;
@@ -85,6 +86,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
85
86
  rpcUrl?: string | undefined;
86
87
  backendUrl?: string | undefined;
87
88
  apiKey?: string | undefined;
89
+ appSource?: string | undefined;
88
90
  marketplace721Contract?: string | undefined;
89
91
  marketplaceContract?: string | undefined;
90
92
  marketplace1155Contract?: string | undefined;
@@ -108,6 +110,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
108
110
  chain?: "STARKNET" | "ETHEREUM" | "SOLANA" | "BASE" | "STELLAR" | "BITCOIN" | undefined;
109
111
  backendUrl?: string | undefined;
110
112
  apiKey?: string | undefined;
113
+ appSource?: string | undefined;
111
114
  marketplace721Contract?: string | undefined;
112
115
  marketplaceContract?: string | undefined;
113
116
  marketplace1155Contract?: string | undefined;
@@ -133,6 +136,7 @@ interface ResolvedConfig {
133
136
  rpcUrl: string;
134
137
  backendUrl: string | undefined;
135
138
  apiKey: string | undefined;
139
+ appSource: string | undefined;
136
140
  marketplace721Contract: string;
137
141
  marketplaceContract: string;
138
142
  marketplace1155Contract: string;
@@ -1267,7 +1271,7 @@ declare class ApiClient {
1267
1271
  private readonly chain;
1268
1272
  private readonly baseHeaders;
1269
1273
  private readonly retryOptions;
1270
- constructor(baseUrl: string, apiKey?: string, retryOptions?: RetryOptions, chain?: Chain);
1274
+ constructor(baseUrl: string, apiKey?: string, retryOptions?: RetryOptions, chain?: Chain, appSource?: string);
1271
1275
  private addr;
1272
1276
  private request;
1273
1277
  private get;
@@ -42,6 +42,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
42
42
  rpcUrl: z.ZodOptional<z.ZodString>;
43
43
  backendUrl: z.ZodOptional<z.ZodString>;
44
44
  apiKey: z.ZodOptional<z.ZodString>;
45
+ appSource: z.ZodOptional<z.ZodString>;
45
46
  marketplace721Contract: z.ZodOptional<z.ZodString>;
46
47
  marketplaceContract: z.ZodOptional<z.ZodString>;
47
48
  marketplace1155Contract: z.ZodOptional<z.ZodString>;
@@ -85,6 +86,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
85
86
  rpcUrl?: string | undefined;
86
87
  backendUrl?: string | undefined;
87
88
  apiKey?: string | undefined;
89
+ appSource?: string | undefined;
88
90
  marketplace721Contract?: string | undefined;
89
91
  marketplaceContract?: string | undefined;
90
92
  marketplace1155Contract?: string | undefined;
@@ -108,6 +110,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
108
110
  chain?: "STARKNET" | "ETHEREUM" | "SOLANA" | "BASE" | "STELLAR" | "BITCOIN" | undefined;
109
111
  backendUrl?: string | undefined;
110
112
  apiKey?: string | undefined;
113
+ appSource?: string | undefined;
111
114
  marketplace721Contract?: string | undefined;
112
115
  marketplaceContract?: string | undefined;
113
116
  marketplace1155Contract?: string | undefined;
@@ -133,6 +136,7 @@ interface ResolvedConfig {
133
136
  rpcUrl: string;
134
137
  backendUrl: string | undefined;
135
138
  apiKey: string | undefined;
139
+ appSource: string | undefined;
136
140
  marketplace721Contract: string;
137
141
  marketplaceContract: string;
138
142
  marketplace1155Contract: string;
@@ -1267,7 +1271,7 @@ declare class ApiClient {
1267
1271
  private readonly chain;
1268
1272
  private readonly baseHeaders;
1269
1273
  private readonly retryOptions;
1270
- constructor(baseUrl: string, apiKey?: string, retryOptions?: RetryOptions, chain?: Chain);
1274
+ constructor(baseUrl: string, apiKey?: string, retryOptions?: RetryOptions, chain?: Chain, appSource?: string);
1271
1275
  private addr;
1272
1276
  private request;
1273
1277
  private get;
package/dist/index.cjs CHANGED
@@ -107,6 +107,7 @@ var MedialaneConfigSchema = zod.z.object({
107
107
  rpcUrl: zod.z.string().url().optional(),
108
108
  backendUrl: zod.z.string().url().optional(),
109
109
  apiKey: zod.z.string().optional(),
110
+ appSource: zod.z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),
110
111
  marketplace721Contract: zod.z.string().optional(),
111
112
  marketplaceContract: zod.z.string().optional(),
112
113
  marketplace1155Contract: zod.z.string().optional(),
@@ -131,6 +132,7 @@ function resolveConfig(raw) {
131
132
  rpcUrl: parsed.rpcUrl ?? coords.rpcUrl,
132
133
  backendUrl: parsed.backendUrl,
133
134
  apiKey: parsed.apiKey,
135
+ appSource: parsed.appSource,
134
136
  marketplace721Contract,
135
137
  marketplaceContract: marketplace721Contract,
136
138
  marketplace1155Contract: parsed.marketplace1155Contract ?? sn.marketplace1155,
@@ -293,10 +295,13 @@ function parseRetryAfter(value) {
293
295
  return void 0;
294
296
  }
295
297
  var ApiClient = class {
296
- constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
298
+ constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET", appSource) {
297
299
  this.baseUrl = baseUrl;
298
300
  this.chain = chain;
299
- this.baseHeaders = apiKey ? { "x-api-key": apiKey } : {};
301
+ this.baseHeaders = {
302
+ ...apiKey ? { "x-api-key": apiKey } : {},
303
+ ...appSource ? { "x-app-source": appSource } : {}
304
+ };
300
305
  this.retryOptions = retryOptions;
301
306
  }
302
307
  addr(a) {