@highlightxyz/cli 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/lib/index.js +193 -2856
- package/package.json +7 -9
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// package.json
|
|
3
3
|
var package_default = {
|
|
4
4
|
name: "@highlightxyz/cli",
|
|
5
|
-
version: "0.3.
|
|
5
|
+
version: "0.3.3",
|
|
6
6
|
description: "Official command-line interface for the Highlight API",
|
|
7
7
|
keywords: [
|
|
8
8
|
"cli",
|
|
@@ -11,2859 +11,178 @@ var package_default = {
|
|
|
11
11
|
"nft",
|
|
12
12
|
"web3"
|
|
13
13
|
],
|
|
14
|
-
homepage: "https://highlight.xyz",
|
|
14
|
+
homepage: "https://docs.highlight.xyz/cli/setup/",
|
|
15
15
|
license: "MIT",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
engines: {
|
|
50
|
-
node: ">=20"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/args.ts
|
|
55
|
-
import { parseArgs } from "node:util";
|
|
56
|
-
|
|
57
|
-
// src/errors.ts
|
|
58
|
-
class CliError extends Error {
|
|
59
|
-
exitCode;
|
|
60
|
-
constructor(message, exitCode = 1) {
|
|
61
|
-
super(message);
|
|
62
|
-
this.name = "CliError";
|
|
63
|
-
this.exitCode = exitCode;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
67
|
-
var errorMessage = (error) => {
|
|
68
|
-
if (typeof error === "string" && error.length > 0) {
|
|
69
|
-
return error;
|
|
70
|
-
}
|
|
71
|
-
if (isRecord(error)) {
|
|
72
|
-
for (const key of ["message", "error", "name"]) {
|
|
73
|
-
const value = error[key];
|
|
74
|
-
if (typeof value === "string" && value.length > 0) {
|
|
75
|
-
return value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return JSON.stringify(error);
|
|
79
|
-
}
|
|
80
|
-
return "Unknown API error";
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
class ApiError extends CliError {
|
|
84
|
-
status;
|
|
85
|
-
details;
|
|
86
|
-
constructor(error, status) {
|
|
87
|
-
super(status ? `Highlight API returned ${status}: ${errorMessage(error)}` : errorMessage(error));
|
|
88
|
-
this.name = "ApiError";
|
|
89
|
-
this.status = status;
|
|
90
|
-
this.details = error;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
var unwrap = (result) => {
|
|
94
|
-
if (result.data !== undefined) {
|
|
95
|
-
return result.data;
|
|
96
|
-
}
|
|
97
|
-
throw new ApiError(result.error, result.response?.status);
|
|
98
|
-
};
|
|
99
|
-
var toErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
100
|
-
|
|
101
|
-
// src/args.ts
|
|
102
|
-
var optionValue = (args, index, option) => {
|
|
103
|
-
const inline = args[index]?.match(new RegExp(`^${option}=(.+)$`))?.[1];
|
|
104
|
-
if (inline !== undefined) {
|
|
105
|
-
return [inline, index];
|
|
106
|
-
}
|
|
107
|
-
const value = args[index + 1];
|
|
108
|
-
if (!value || value.startsWith("-")) {
|
|
109
|
-
throw new CliError(`${option} requires a value`, 2);
|
|
110
|
-
}
|
|
111
|
-
return [value, index + 1];
|
|
112
|
-
};
|
|
113
|
-
var extractGlobalOptions = (args) => {
|
|
114
|
-
const global = {
|
|
115
|
-
help: false,
|
|
116
|
-
json: false,
|
|
117
|
-
version: false
|
|
118
|
-
};
|
|
119
|
-
const remaining = [];
|
|
120
|
-
for (let index = 0;index < args.length; index += 1) {
|
|
121
|
-
const argument = args[index];
|
|
122
|
-
if (argument === "--json") {
|
|
123
|
-
global.json = true;
|
|
124
|
-
} else if (argument === "--help" || argument === "-h") {
|
|
125
|
-
global.help = true;
|
|
126
|
-
} else if (argument === "--version" || argument === "-v") {
|
|
127
|
-
global.version = true;
|
|
128
|
-
} else if (argument === "--profile" || argument.startsWith("--profile=")) {
|
|
129
|
-
const [value, consumedIndex] = optionValue(args, index, "--profile");
|
|
130
|
-
global.profile = value;
|
|
131
|
-
index = consumedIndex;
|
|
132
|
-
} else if (argument === "--api-url" || argument.startsWith("--api-url=")) {
|
|
133
|
-
const [value, consumedIndex] = optionValue(args, index, "--api-url");
|
|
134
|
-
global.apiUrl = value;
|
|
135
|
-
index = consumedIndex;
|
|
136
|
-
} else {
|
|
137
|
-
remaining.push(argument);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return { args: remaining, global };
|
|
141
|
-
};
|
|
142
|
-
var parseCommandArgs = (args, config) => {
|
|
143
|
-
try {
|
|
144
|
-
return parseArgs({
|
|
145
|
-
allowPositionals: true,
|
|
146
|
-
args,
|
|
147
|
-
options: config.options,
|
|
148
|
-
strict: true
|
|
149
|
-
});
|
|
150
|
-
} catch (error) {
|
|
151
|
-
throw new CliError(toErrorMessage(error), 2);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var requiredPositional = (positionals, index, label) => {
|
|
155
|
-
const value = positionals[index];
|
|
156
|
-
if (!value) {
|
|
157
|
-
throw new CliError(`Missing required argument: ${label}`, 2);
|
|
158
|
-
}
|
|
159
|
-
return value;
|
|
160
|
-
};
|
|
161
|
-
var assertNoExtraPositionals = (positionals, expected) => {
|
|
162
|
-
if (positionals.length > expected) {
|
|
163
|
-
throw new CliError(`Unexpected argument: ${positionals[expected]}`, 2);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
var positiveInteger = (value, label) => {
|
|
167
|
-
if (value === undefined)
|
|
168
|
-
return;
|
|
169
|
-
const parsed = Number(value);
|
|
170
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
171
|
-
throw new CliError(`${label} must be a positive integer`, 2);
|
|
172
|
-
}
|
|
173
|
-
return parsed;
|
|
174
|
-
};
|
|
175
|
-
var positiveNumber = (value, label) => {
|
|
176
|
-
if (value === undefined)
|
|
177
|
-
return;
|
|
178
|
-
const parsed = Number(value);
|
|
179
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
180
|
-
throw new CliError(`${label} must be a positive number`, 2);
|
|
181
|
-
}
|
|
182
|
-
return parsed;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// ../sdk/src/v1/gen/types.gen.ts
|
|
186
|
-
var CollectionType;
|
|
187
|
-
((CollectionType2) => {
|
|
188
|
-
CollectionType2["OpenEdition"] = "OpenEdition";
|
|
189
|
-
CollectionType2["LimitedEdition"] = "LimitedEdition";
|
|
190
|
-
CollectionType2["OneOfOne"] = "OneOfOne";
|
|
191
|
-
CollectionType2["Series"] = "Series";
|
|
192
|
-
CollectionType2["GenerativeSeries"] = "GenerativeSeries";
|
|
193
|
-
})(CollectionType ||= {});
|
|
194
|
-
var ContractStandard;
|
|
195
|
-
((ContractStandard2) => {
|
|
196
|
-
ContractStandard2["Erc721"] = "ERC721";
|
|
197
|
-
ContractStandard2["Erc1155"] = "ERC1155";
|
|
198
|
-
})(ContractStandard ||= {});
|
|
199
|
-
var SaleType;
|
|
200
|
-
((SaleType2) => {
|
|
201
|
-
SaleType2["FixedPrice"] = "FIXED_PRICE";
|
|
202
|
-
SaleType2["DutchAuction"] = "DUTCH_AUCTION";
|
|
203
|
-
SaleType2["RankedAuction"] = "RANKED_AUCTION";
|
|
204
|
-
SaleType2["EnglishAuction"] = "ENGLISH_AUCTION";
|
|
205
|
-
SaleType2["Custom"] = "CUSTOM";
|
|
206
|
-
})(SaleType ||= {});
|
|
207
|
-
var SaleAccessMode;
|
|
208
|
-
((SaleAccessMode2) => {
|
|
209
|
-
SaleAccessMode2["Public"] = "PUBLIC";
|
|
210
|
-
SaleAccessMode2["Gated"] = "GATED";
|
|
211
|
-
})(SaleAccessMode ||= {});
|
|
212
|
-
var MediaPurpose;
|
|
213
|
-
((MediaPurpose2) => {
|
|
214
|
-
MediaPurpose2["CollectionLogo"] = "CollectionLogo";
|
|
215
|
-
MediaPurpose2["EditionImage"] = "EditionImage";
|
|
216
|
-
MediaPurpose2["EditionAnimation"] = "EditionAnimation";
|
|
217
|
-
MediaPurpose2["SeriesAssets"] = "SeriesAssets";
|
|
218
|
-
MediaPurpose2["GenerativeCode"] = "GenerativeCode";
|
|
219
|
-
MediaPurpose2["UserAvatar"] = "UserAvatar";
|
|
220
|
-
})(MediaPurpose ||= {});
|
|
221
|
-
var GateMatchMode;
|
|
222
|
-
((GateMatchMode2) => {
|
|
223
|
-
GateMatchMode2["All"] = "ALL";
|
|
224
|
-
GateMatchMode2["Any"] = "ANY";
|
|
225
|
-
})(GateMatchMode ||= {});
|
|
226
|
-
// ../sdk/src/v1/gen/core/bodySerializer.gen.ts
|
|
227
|
-
var jsonBodySerializer = {
|
|
228
|
-
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
229
|
-
};
|
|
230
|
-
// ../sdk/src/v1/gen/core/params.gen.ts
|
|
231
|
-
var extraPrefixesMap = {
|
|
232
|
-
$body_: "body",
|
|
233
|
-
$headers_: "headers",
|
|
234
|
-
$path_: "path",
|
|
235
|
-
$query_: "query"
|
|
236
|
-
};
|
|
237
|
-
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
238
|
-
var buildKeyMap = (fields, map) => {
|
|
239
|
-
if (!map) {
|
|
240
|
-
map = new Map;
|
|
241
|
-
}
|
|
242
|
-
for (const config of fields) {
|
|
243
|
-
if ("in" in config) {
|
|
244
|
-
if (config.key) {
|
|
245
|
-
map.set(config.key, {
|
|
246
|
-
in: config.in,
|
|
247
|
-
map: config.map
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
} else if ("key" in config) {
|
|
251
|
-
map.set(config.key, {
|
|
252
|
-
map: config.map
|
|
253
|
-
});
|
|
254
|
-
} else if (config.args) {
|
|
255
|
-
buildKeyMap(config.args, map);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return map;
|
|
259
|
-
};
|
|
260
|
-
var stripEmptySlots = (params) => {
|
|
261
|
-
for (const [slot, value] of Object.entries(params)) {
|
|
262
|
-
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
263
|
-
delete params[slot];
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
var buildClientParams = (args, fields) => {
|
|
268
|
-
const params = {
|
|
269
|
-
body: {},
|
|
270
|
-
headers: {},
|
|
271
|
-
path: {},
|
|
272
|
-
query: {}
|
|
273
|
-
};
|
|
274
|
-
const map = buildKeyMap(fields);
|
|
275
|
-
let config;
|
|
276
|
-
for (const [index, arg] of args.entries()) {
|
|
277
|
-
if (fields[index]) {
|
|
278
|
-
config = fields[index];
|
|
279
|
-
}
|
|
280
|
-
if (!config) {
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
if ("in" in config) {
|
|
284
|
-
if (config.key) {
|
|
285
|
-
const field = map.get(config.key);
|
|
286
|
-
const name = field.map || config.key;
|
|
287
|
-
if (field.in) {
|
|
288
|
-
params[field.in][name] = arg;
|
|
289
|
-
}
|
|
290
|
-
} else {
|
|
291
|
-
params.body = arg;
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
for (const [key, value] of Object.entries(arg ?? {})) {
|
|
295
|
-
const field = map.get(key);
|
|
296
|
-
if (field) {
|
|
297
|
-
if (field.in) {
|
|
298
|
-
const name = field.map || key;
|
|
299
|
-
params[field.in][name] = value;
|
|
300
|
-
} else {
|
|
301
|
-
params[field.map] = value;
|
|
302
|
-
}
|
|
303
|
-
} else {
|
|
304
|
-
const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
|
|
305
|
-
if (extra) {
|
|
306
|
-
const [prefix, slot] = extra;
|
|
307
|
-
params[slot][key.slice(prefix.length)] = value;
|
|
308
|
-
} else if ("allowExtra" in config && config.allowExtra) {
|
|
309
|
-
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
|
310
|
-
if (allowed) {
|
|
311
|
-
params[slot][key] = value;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
stripEmptySlots(params);
|
|
321
|
-
return params;
|
|
322
|
-
};
|
|
323
|
-
// ../sdk/src/v1/gen/core/serverSentEvents.gen.ts
|
|
324
|
-
var createSseClient = ({
|
|
325
|
-
onRequest,
|
|
326
|
-
onSseError,
|
|
327
|
-
onSseEvent,
|
|
328
|
-
responseTransformer,
|
|
329
|
-
responseValidator,
|
|
330
|
-
sseDefaultRetryDelay,
|
|
331
|
-
sseMaxRetryAttempts,
|
|
332
|
-
sseMaxRetryDelay,
|
|
333
|
-
sseSleepFn,
|
|
334
|
-
url,
|
|
335
|
-
...options
|
|
336
|
-
}) => {
|
|
337
|
-
let lastEventId;
|
|
338
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
339
|
-
const createStream = async function* () {
|
|
340
|
-
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
341
|
-
let attempt = 0;
|
|
342
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
343
|
-
while (true) {
|
|
344
|
-
if (signal.aborted)
|
|
345
|
-
break;
|
|
346
|
-
attempt++;
|
|
347
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
348
|
-
if (lastEventId !== undefined) {
|
|
349
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
350
|
-
}
|
|
351
|
-
try {
|
|
352
|
-
const requestInit = {
|
|
353
|
-
redirect: "follow",
|
|
354
|
-
...options,
|
|
355
|
-
body: options.serializedBody,
|
|
356
|
-
headers,
|
|
357
|
-
signal
|
|
358
|
-
};
|
|
359
|
-
let request = new Request(url, requestInit);
|
|
360
|
-
if (onRequest) {
|
|
361
|
-
request = await onRequest(url, requestInit);
|
|
362
|
-
}
|
|
363
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
364
|
-
const response = await _fetch(request);
|
|
365
|
-
if (!response.ok)
|
|
366
|
-
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
367
|
-
if (!response.body)
|
|
368
|
-
throw new Error("No body in SSE response");
|
|
369
|
-
const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
|
|
370
|
-
let buffer = "";
|
|
371
|
-
const abortHandler = () => {
|
|
372
|
-
try {
|
|
373
|
-
reader.cancel();
|
|
374
|
-
} catch {}
|
|
375
|
-
};
|
|
376
|
-
signal.addEventListener("abort", abortHandler);
|
|
377
|
-
try {
|
|
378
|
-
while (true) {
|
|
379
|
-
const { done, value } = await reader.read();
|
|
380
|
-
if (done)
|
|
381
|
-
break;
|
|
382
|
-
buffer += value;
|
|
383
|
-
buffer = buffer.replace(/\r\n/g, `
|
|
384
|
-
`).replace(/\r/g, `
|
|
385
|
-
`);
|
|
386
|
-
const chunks = buffer.split(`
|
|
387
|
-
|
|
388
|
-
`);
|
|
389
|
-
buffer = chunks.pop() ?? "";
|
|
390
|
-
for (const chunk of chunks) {
|
|
391
|
-
const lines = chunk.split(`
|
|
392
|
-
`);
|
|
393
|
-
const dataLines = [];
|
|
394
|
-
let eventName;
|
|
395
|
-
for (const line of lines) {
|
|
396
|
-
if (line.startsWith("data:")) {
|
|
397
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
398
|
-
} else if (line.startsWith("event:")) {
|
|
399
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
400
|
-
} else if (line.startsWith("id:")) {
|
|
401
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
402
|
-
} else if (line.startsWith("retry:")) {
|
|
403
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
404
|
-
if (!Number.isNaN(parsed)) {
|
|
405
|
-
retryDelay = parsed;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
let data;
|
|
410
|
-
let parsedJson = false;
|
|
411
|
-
if (dataLines.length) {
|
|
412
|
-
const rawData = dataLines.join(`
|
|
413
|
-
`);
|
|
414
|
-
try {
|
|
415
|
-
data = JSON.parse(rawData);
|
|
416
|
-
parsedJson = true;
|
|
417
|
-
} catch {
|
|
418
|
-
data = rawData;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
if (parsedJson) {
|
|
422
|
-
if (responseValidator) {
|
|
423
|
-
await responseValidator(data);
|
|
424
|
-
}
|
|
425
|
-
if (responseTransformer) {
|
|
426
|
-
data = await responseTransformer(data);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
onSseEvent?.({
|
|
430
|
-
data,
|
|
431
|
-
event: eventName,
|
|
432
|
-
id: lastEventId,
|
|
433
|
-
retry: retryDelay
|
|
434
|
-
});
|
|
435
|
-
if (dataLines.length) {
|
|
436
|
-
yield data;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
} finally {
|
|
441
|
-
signal.removeEventListener("abort", abortHandler);
|
|
442
|
-
reader.releaseLock();
|
|
443
|
-
}
|
|
444
|
-
break;
|
|
445
|
-
} catch (error) {
|
|
446
|
-
onSseError?.(error);
|
|
447
|
-
if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
|
451
|
-
await sleep(backoff);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
const stream = createStream();
|
|
456
|
-
return { stream };
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
// ../sdk/src/v1/gen/core/pathSerializer.gen.ts
|
|
460
|
-
var separatorArrayExplode = (style) => {
|
|
461
|
-
switch (style) {
|
|
462
|
-
case "label":
|
|
463
|
-
return ".";
|
|
464
|
-
case "matrix":
|
|
465
|
-
return ";";
|
|
466
|
-
case "simple":
|
|
467
|
-
return ",";
|
|
468
|
-
default:
|
|
469
|
-
return "&";
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
var separatorArrayNoExplode = (style) => {
|
|
473
|
-
switch (style) {
|
|
474
|
-
case "form":
|
|
475
|
-
return ",";
|
|
476
|
-
case "pipeDelimited":
|
|
477
|
-
return "|";
|
|
478
|
-
case "spaceDelimited":
|
|
479
|
-
return "%20";
|
|
480
|
-
default:
|
|
481
|
-
return ",";
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
var separatorObjectExplode = (style) => {
|
|
485
|
-
switch (style) {
|
|
486
|
-
case "label":
|
|
487
|
-
return ".";
|
|
488
|
-
case "matrix":
|
|
489
|
-
return ";";
|
|
490
|
-
case "simple":
|
|
491
|
-
return ",";
|
|
492
|
-
default:
|
|
493
|
-
return "&";
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
var serializeArrayParam = ({
|
|
497
|
-
allowReserved,
|
|
498
|
-
explode,
|
|
499
|
-
name,
|
|
500
|
-
style,
|
|
501
|
-
value
|
|
502
|
-
}) => {
|
|
503
|
-
if (!explode) {
|
|
504
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
505
|
-
switch (style) {
|
|
506
|
-
case "label":
|
|
507
|
-
return `.${joinedValues2}`;
|
|
508
|
-
case "matrix":
|
|
509
|
-
return `;${name}=${joinedValues2}`;
|
|
510
|
-
case "simple":
|
|
511
|
-
return joinedValues2;
|
|
512
|
-
default:
|
|
513
|
-
return `${name}=${joinedValues2}`;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
const separator = separatorArrayExplode(style);
|
|
517
|
-
const joinedValues = value.map((v) => {
|
|
518
|
-
if (style === "label" || style === "simple") {
|
|
519
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
520
|
-
}
|
|
521
|
-
return serializePrimitiveParam({
|
|
522
|
-
allowReserved,
|
|
523
|
-
name,
|
|
524
|
-
value: v
|
|
525
|
-
});
|
|
526
|
-
}).join(separator);
|
|
527
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
528
|
-
};
|
|
529
|
-
var serializePrimitiveParam = ({
|
|
530
|
-
allowReserved,
|
|
531
|
-
name,
|
|
532
|
-
value
|
|
533
|
-
}) => {
|
|
534
|
-
if (value === undefined || value === null) {
|
|
535
|
-
return "";
|
|
536
|
-
}
|
|
537
|
-
if (typeof value === "object") {
|
|
538
|
-
throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
539
|
-
}
|
|
540
|
-
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
541
|
-
};
|
|
542
|
-
var serializeObjectParam = ({
|
|
543
|
-
allowReserved,
|
|
544
|
-
explode,
|
|
545
|
-
name,
|
|
546
|
-
style,
|
|
547
|
-
value,
|
|
548
|
-
valueOnly
|
|
549
|
-
}) => {
|
|
550
|
-
if (value instanceof Date) {
|
|
551
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
552
|
-
}
|
|
553
|
-
if (style !== "deepObject" && !explode) {
|
|
554
|
-
let values = [];
|
|
555
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
556
|
-
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
557
|
-
});
|
|
558
|
-
const joinedValues2 = values.join(",");
|
|
559
|
-
switch (style) {
|
|
560
|
-
case "form":
|
|
561
|
-
return `${name}=${joinedValues2}`;
|
|
562
|
-
case "label":
|
|
563
|
-
return `.${joinedValues2}`;
|
|
564
|
-
case "matrix":
|
|
565
|
-
return `;${name}=${joinedValues2}`;
|
|
566
|
-
default:
|
|
567
|
-
return joinedValues2;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
const separator = separatorObjectExplode(style);
|
|
571
|
-
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
572
|
-
allowReserved,
|
|
573
|
-
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
574
|
-
value: v
|
|
575
|
-
})).join(separator);
|
|
576
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// ../sdk/src/v1/gen/core/utils.gen.ts
|
|
580
|
-
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
581
|
-
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
582
|
-
let url = _url;
|
|
583
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
584
|
-
if (matches) {
|
|
585
|
-
for (const match of matches) {
|
|
586
|
-
let explode = false;
|
|
587
|
-
let name = match.substring(1, match.length - 1);
|
|
588
|
-
let style = "simple";
|
|
589
|
-
if (name.endsWith("*")) {
|
|
590
|
-
explode = true;
|
|
591
|
-
name = name.substring(0, name.length - 1);
|
|
592
|
-
}
|
|
593
|
-
if (name.startsWith(".")) {
|
|
594
|
-
name = name.substring(1);
|
|
595
|
-
style = "label";
|
|
596
|
-
} else if (name.startsWith(";")) {
|
|
597
|
-
name = name.substring(1);
|
|
598
|
-
style = "matrix";
|
|
599
|
-
}
|
|
600
|
-
const value = path[name];
|
|
601
|
-
if (value === undefined || value === null) {
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (Array.isArray(value)) {
|
|
605
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
606
|
-
continue;
|
|
607
|
-
}
|
|
608
|
-
if (typeof value === "object") {
|
|
609
|
-
url = url.replace(match, serializeObjectParam({
|
|
610
|
-
explode,
|
|
611
|
-
name,
|
|
612
|
-
style,
|
|
613
|
-
value,
|
|
614
|
-
valueOnly: true
|
|
615
|
-
}));
|
|
616
|
-
continue;
|
|
617
|
-
}
|
|
618
|
-
if (style === "matrix") {
|
|
619
|
-
url = url.replace(match, `;${serializePrimitiveParam({
|
|
620
|
-
name,
|
|
621
|
-
value
|
|
622
|
-
})}`);
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
626
|
-
url = url.replace(match, replaceValue);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
return url;
|
|
630
|
-
};
|
|
631
|
-
var getUrl = ({
|
|
632
|
-
baseUrl,
|
|
633
|
-
path,
|
|
634
|
-
query,
|
|
635
|
-
querySerializer,
|
|
636
|
-
url: _url
|
|
637
|
-
}) => {
|
|
638
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
639
|
-
let url = (baseUrl ?? "") + pathUrl;
|
|
640
|
-
if (path) {
|
|
641
|
-
url = defaultPathSerializer({ path, url });
|
|
642
|
-
}
|
|
643
|
-
let search = query ? querySerializer(query) : "";
|
|
644
|
-
if (search.startsWith("?")) {
|
|
645
|
-
search = search.substring(1);
|
|
646
|
-
}
|
|
647
|
-
if (search) {
|
|
648
|
-
url += `?${search}`;
|
|
649
|
-
}
|
|
650
|
-
return url;
|
|
651
|
-
};
|
|
652
|
-
function getValidRequestBody(options) {
|
|
653
|
-
const hasBody = options.body !== undefined;
|
|
654
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
655
|
-
if (isSerializedBody) {
|
|
656
|
-
if ("serializedBody" in options) {
|
|
657
|
-
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
|
|
658
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
659
|
-
}
|
|
660
|
-
return options.body !== "" ? options.body : null;
|
|
661
|
-
}
|
|
662
|
-
if (hasBody) {
|
|
663
|
-
return options.body;
|
|
664
|
-
}
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// ../sdk/src/v1/gen/core/auth.gen.ts
|
|
669
|
-
var getAuthToken = async (auth, callback) => {
|
|
670
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
671
|
-
if (!token) {
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
if (auth.scheme === "bearer") {
|
|
675
|
-
return `Bearer ${token}`;
|
|
676
|
-
}
|
|
677
|
-
if (auth.scheme === "basic") {
|
|
678
|
-
return `Basic ${btoa(token)}`;
|
|
679
|
-
}
|
|
680
|
-
return token;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
// ../sdk/src/v1/gen/client/utils.gen.ts
|
|
684
|
-
var createQuerySerializer = ({
|
|
685
|
-
parameters = {},
|
|
686
|
-
...args
|
|
687
|
-
} = {}) => {
|
|
688
|
-
const querySerializer = (queryParams) => {
|
|
689
|
-
const search = [];
|
|
690
|
-
if (queryParams && typeof queryParams === "object") {
|
|
691
|
-
for (const name in queryParams) {
|
|
692
|
-
const value = queryParams[name];
|
|
693
|
-
if (value === undefined || value === null) {
|
|
694
|
-
continue;
|
|
695
|
-
}
|
|
696
|
-
const options = parameters[name] || args;
|
|
697
|
-
if (Array.isArray(value)) {
|
|
698
|
-
const serializedArray = serializeArrayParam({
|
|
699
|
-
allowReserved: options.allowReserved,
|
|
700
|
-
explode: true,
|
|
701
|
-
name,
|
|
702
|
-
style: "form",
|
|
703
|
-
value,
|
|
704
|
-
...options.array
|
|
705
|
-
});
|
|
706
|
-
if (serializedArray)
|
|
707
|
-
search.push(serializedArray);
|
|
708
|
-
} else if (typeof value === "object") {
|
|
709
|
-
const serializedObject = serializeObjectParam({
|
|
710
|
-
allowReserved: options.allowReserved,
|
|
711
|
-
explode: true,
|
|
712
|
-
name,
|
|
713
|
-
style: "deepObject",
|
|
714
|
-
value,
|
|
715
|
-
...options.object
|
|
716
|
-
});
|
|
717
|
-
if (serializedObject)
|
|
718
|
-
search.push(serializedObject);
|
|
719
|
-
} else {
|
|
720
|
-
const serializedPrimitive = serializePrimitiveParam({
|
|
721
|
-
allowReserved: options.allowReserved,
|
|
722
|
-
name,
|
|
723
|
-
value
|
|
724
|
-
});
|
|
725
|
-
if (serializedPrimitive)
|
|
726
|
-
search.push(serializedPrimitive);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return search.join("&");
|
|
731
|
-
};
|
|
732
|
-
return querySerializer;
|
|
733
|
-
};
|
|
734
|
-
var getParseAs = (contentType) => {
|
|
735
|
-
if (!contentType) {
|
|
736
|
-
return "stream";
|
|
737
|
-
}
|
|
738
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
739
|
-
if (!cleanContent) {
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
743
|
-
return "json";
|
|
744
|
-
}
|
|
745
|
-
if (cleanContent === "multipart/form-data") {
|
|
746
|
-
return "formData";
|
|
747
|
-
}
|
|
748
|
-
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
749
|
-
return "blob";
|
|
750
|
-
}
|
|
751
|
-
if (cleanContent.startsWith("text/")) {
|
|
752
|
-
return "text";
|
|
753
|
-
}
|
|
754
|
-
return;
|
|
755
|
-
};
|
|
756
|
-
var checkForExistence = (options, name) => {
|
|
757
|
-
if (!name) {
|
|
758
|
-
return false;
|
|
759
|
-
}
|
|
760
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
761
|
-
return true;
|
|
762
|
-
}
|
|
763
|
-
return false;
|
|
764
|
-
};
|
|
765
|
-
var setAuthParams = async ({
|
|
766
|
-
security,
|
|
767
|
-
...options
|
|
768
|
-
}) => {
|
|
769
|
-
for (const auth of security) {
|
|
770
|
-
if (checkForExistence(options, auth.name)) {
|
|
771
|
-
continue;
|
|
772
|
-
}
|
|
773
|
-
const token = await getAuthToken(auth, options.auth);
|
|
774
|
-
if (!token) {
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
const name = auth.name ?? "Authorization";
|
|
778
|
-
switch (auth.in) {
|
|
779
|
-
case "query":
|
|
780
|
-
if (!options.query) {
|
|
781
|
-
options.query = {};
|
|
782
|
-
}
|
|
783
|
-
options.query[name] = token;
|
|
784
|
-
break;
|
|
785
|
-
case "cookie":
|
|
786
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
787
|
-
break;
|
|
788
|
-
case "header":
|
|
789
|
-
default:
|
|
790
|
-
options.headers.set(name, token);
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
var buildUrl = (options) => getUrl({
|
|
796
|
-
baseUrl: options.baseUrl,
|
|
797
|
-
path: options.path,
|
|
798
|
-
query: options.query,
|
|
799
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
800
|
-
url: options.url
|
|
801
|
-
});
|
|
802
|
-
var mergeConfigs = (a, b) => {
|
|
803
|
-
const config = { ...a, ...b };
|
|
804
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
805
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
806
|
-
}
|
|
807
|
-
config.headers = mergeHeaders(a.headers, b.headers);
|
|
808
|
-
return config;
|
|
809
|
-
};
|
|
810
|
-
var headersEntries = (headers) => {
|
|
811
|
-
const entries = [];
|
|
812
|
-
headers.forEach((value, key) => {
|
|
813
|
-
entries.push([key, value]);
|
|
814
|
-
});
|
|
815
|
-
return entries;
|
|
816
|
-
};
|
|
817
|
-
var mergeHeaders = (...headers) => {
|
|
818
|
-
const mergedHeaders = new Headers;
|
|
819
|
-
for (const header of headers) {
|
|
820
|
-
if (!header) {
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
824
|
-
for (const [key, value] of iterator) {
|
|
825
|
-
if (value === null) {
|
|
826
|
-
mergedHeaders.delete(key);
|
|
827
|
-
} else if (Array.isArray(value)) {
|
|
828
|
-
for (const v of value) {
|
|
829
|
-
mergedHeaders.append(key, v);
|
|
830
|
-
}
|
|
831
|
-
} else if (value !== undefined) {
|
|
832
|
-
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
return mergedHeaders;
|
|
837
|
-
};
|
|
838
|
-
|
|
839
|
-
class Interceptors {
|
|
840
|
-
fns = [];
|
|
841
|
-
clear() {
|
|
842
|
-
this.fns = [];
|
|
843
|
-
}
|
|
844
|
-
eject(id) {
|
|
845
|
-
const index = this.getInterceptorIndex(id);
|
|
846
|
-
if (this.fns[index]) {
|
|
847
|
-
this.fns[index] = null;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
exists(id) {
|
|
851
|
-
const index = this.getInterceptorIndex(id);
|
|
852
|
-
return Boolean(this.fns[index]);
|
|
853
|
-
}
|
|
854
|
-
getInterceptorIndex(id) {
|
|
855
|
-
if (typeof id === "number") {
|
|
856
|
-
return this.fns[id] ? id : -1;
|
|
857
|
-
}
|
|
858
|
-
return this.fns.indexOf(id);
|
|
859
|
-
}
|
|
860
|
-
update(id, fn) {
|
|
861
|
-
const index = this.getInterceptorIndex(id);
|
|
862
|
-
if (this.fns[index]) {
|
|
863
|
-
this.fns[index] = fn;
|
|
864
|
-
return id;
|
|
865
|
-
}
|
|
866
|
-
return false;
|
|
867
|
-
}
|
|
868
|
-
use(fn) {
|
|
869
|
-
this.fns.push(fn);
|
|
870
|
-
return this.fns.length - 1;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
var createInterceptors = () => ({
|
|
874
|
-
error: new Interceptors,
|
|
875
|
-
request: new Interceptors,
|
|
876
|
-
response: new Interceptors
|
|
877
|
-
});
|
|
878
|
-
var defaultQuerySerializer = createQuerySerializer({
|
|
879
|
-
allowReserved: false,
|
|
880
|
-
array: {
|
|
881
|
-
explode: true,
|
|
882
|
-
style: "form"
|
|
883
|
-
},
|
|
884
|
-
object: {
|
|
885
|
-
explode: true,
|
|
886
|
-
style: "deepObject"
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
var defaultHeaders = {
|
|
890
|
-
"Content-Type": "application/json"
|
|
891
|
-
};
|
|
892
|
-
var createConfig = (override = {}) => ({
|
|
893
|
-
...jsonBodySerializer,
|
|
894
|
-
headers: defaultHeaders,
|
|
895
|
-
parseAs: "auto",
|
|
896
|
-
querySerializer: defaultQuerySerializer,
|
|
897
|
-
...override
|
|
898
|
-
});
|
|
899
|
-
|
|
900
|
-
// ../sdk/src/v1/gen/client/client.gen.ts
|
|
901
|
-
var createClient = (config = {}) => {
|
|
902
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
903
|
-
const getConfig = () => ({ ..._config });
|
|
904
|
-
const setConfig = (config2) => {
|
|
905
|
-
_config = mergeConfigs(_config, config2);
|
|
906
|
-
return getConfig();
|
|
907
|
-
};
|
|
908
|
-
const interceptors = createInterceptors();
|
|
909
|
-
const beforeRequest = async (options) => {
|
|
910
|
-
const opts = {
|
|
911
|
-
..._config,
|
|
912
|
-
...options,
|
|
913
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
914
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
915
|
-
serializedBody: undefined
|
|
916
|
-
};
|
|
917
|
-
if (opts.security) {
|
|
918
|
-
await setAuthParams({
|
|
919
|
-
...opts,
|
|
920
|
-
security: opts.security
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
if (opts.requestValidator) {
|
|
924
|
-
await opts.requestValidator(opts);
|
|
925
|
-
}
|
|
926
|
-
if (opts.body !== undefined && opts.bodySerializer) {
|
|
927
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
928
|
-
}
|
|
929
|
-
if (opts.body === undefined || opts.serializedBody === "") {
|
|
930
|
-
opts.headers.delete("Content-Type");
|
|
931
|
-
}
|
|
932
|
-
const url = buildUrl(opts);
|
|
933
|
-
return { opts, url };
|
|
934
|
-
};
|
|
935
|
-
const request = async (options) => {
|
|
936
|
-
const { opts, url } = await beforeRequest(options);
|
|
937
|
-
const requestInit = {
|
|
938
|
-
redirect: "follow",
|
|
939
|
-
...opts,
|
|
940
|
-
body: getValidRequestBody(opts)
|
|
941
|
-
};
|
|
942
|
-
let request2 = new Request(url, requestInit);
|
|
943
|
-
for (const fn of interceptors.request.fns) {
|
|
944
|
-
if (fn) {
|
|
945
|
-
request2 = await fn(request2, opts);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
const _fetch = opts.fetch;
|
|
949
|
-
let response;
|
|
950
|
-
try {
|
|
951
|
-
response = await _fetch(request2);
|
|
952
|
-
} catch (error2) {
|
|
953
|
-
let finalError2 = error2;
|
|
954
|
-
for (const fn of interceptors.error.fns) {
|
|
955
|
-
if (fn) {
|
|
956
|
-
finalError2 = await fn(error2, undefined, request2, opts);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
finalError2 = finalError2 || {};
|
|
960
|
-
if (opts.throwOnError) {
|
|
961
|
-
throw finalError2;
|
|
962
|
-
}
|
|
963
|
-
return opts.responseStyle === "data" ? undefined : {
|
|
964
|
-
error: finalError2,
|
|
965
|
-
request: request2,
|
|
966
|
-
response: undefined
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
for (const fn of interceptors.response.fns) {
|
|
970
|
-
if (fn) {
|
|
971
|
-
response = await fn(response, request2, opts);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
const result = {
|
|
975
|
-
request: request2,
|
|
976
|
-
response
|
|
977
|
-
};
|
|
978
|
-
if (response.ok) {
|
|
979
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
980
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
981
|
-
let emptyData;
|
|
982
|
-
switch (parseAs) {
|
|
983
|
-
case "arrayBuffer":
|
|
984
|
-
case "blob":
|
|
985
|
-
case "text":
|
|
986
|
-
emptyData = await response[parseAs]();
|
|
987
|
-
break;
|
|
988
|
-
case "formData":
|
|
989
|
-
emptyData = new FormData;
|
|
990
|
-
break;
|
|
991
|
-
case "stream":
|
|
992
|
-
emptyData = response.body;
|
|
993
|
-
break;
|
|
994
|
-
case "json":
|
|
995
|
-
default:
|
|
996
|
-
emptyData = {};
|
|
997
|
-
break;
|
|
998
|
-
}
|
|
999
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
1000
|
-
data: emptyData,
|
|
1001
|
-
...result
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
let data;
|
|
1005
|
-
switch (parseAs) {
|
|
1006
|
-
case "arrayBuffer":
|
|
1007
|
-
case "blob":
|
|
1008
|
-
case "formData":
|
|
1009
|
-
case "text":
|
|
1010
|
-
data = await response[parseAs]();
|
|
1011
|
-
break;
|
|
1012
|
-
case "json": {
|
|
1013
|
-
const text = await response.text();
|
|
1014
|
-
data = text ? JSON.parse(text) : {};
|
|
1015
|
-
break;
|
|
1016
|
-
}
|
|
1017
|
-
case "stream":
|
|
1018
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
1019
|
-
data: response.body,
|
|
1020
|
-
...result
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
if (parseAs === "json") {
|
|
1024
|
-
if (opts.responseValidator) {
|
|
1025
|
-
await opts.responseValidator(data);
|
|
1026
|
-
}
|
|
1027
|
-
if (opts.responseTransformer) {
|
|
1028
|
-
data = await opts.responseTransformer(data);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
return opts.responseStyle === "data" ? data : {
|
|
1032
|
-
data,
|
|
1033
|
-
...result
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
const textError = await response.text();
|
|
1037
|
-
let jsonError;
|
|
1038
|
-
try {
|
|
1039
|
-
jsonError = JSON.parse(textError);
|
|
1040
|
-
} catch {}
|
|
1041
|
-
const error = jsonError ?? textError;
|
|
1042
|
-
let finalError = error;
|
|
1043
|
-
for (const fn of interceptors.error.fns) {
|
|
1044
|
-
if (fn) {
|
|
1045
|
-
finalError = await fn(error, response, request2, opts);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
finalError = finalError || {};
|
|
1049
|
-
if (opts.throwOnError) {
|
|
1050
|
-
throw finalError;
|
|
1051
|
-
}
|
|
1052
|
-
return opts.responseStyle === "data" ? undefined : {
|
|
1053
|
-
error: finalError,
|
|
1054
|
-
...result
|
|
1055
|
-
};
|
|
1056
|
-
};
|
|
1057
|
-
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
1058
|
-
const makeSseFn = (method) => async (options) => {
|
|
1059
|
-
const { opts, url } = await beforeRequest(options);
|
|
1060
|
-
return createSseClient({
|
|
1061
|
-
...opts,
|
|
1062
|
-
body: opts.body,
|
|
1063
|
-
headers: opts.headers,
|
|
1064
|
-
method,
|
|
1065
|
-
onRequest: async (url2, init) => {
|
|
1066
|
-
let request2 = new Request(url2, init);
|
|
1067
|
-
for (const fn of interceptors.request.fns) {
|
|
1068
|
-
if (fn) {
|
|
1069
|
-
request2 = await fn(request2, opts);
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
return request2;
|
|
1073
|
-
},
|
|
1074
|
-
serializedBody: getValidRequestBody(opts),
|
|
1075
|
-
url
|
|
1076
|
-
});
|
|
1077
|
-
};
|
|
1078
|
-
return {
|
|
1079
|
-
buildUrl,
|
|
1080
|
-
connect: makeMethodFn("CONNECT"),
|
|
1081
|
-
delete: makeMethodFn("DELETE"),
|
|
1082
|
-
get: makeMethodFn("GET"),
|
|
1083
|
-
getConfig,
|
|
1084
|
-
head: makeMethodFn("HEAD"),
|
|
1085
|
-
interceptors,
|
|
1086
|
-
options: makeMethodFn("OPTIONS"),
|
|
1087
|
-
patch: makeMethodFn("PATCH"),
|
|
1088
|
-
post: makeMethodFn("POST"),
|
|
1089
|
-
put: makeMethodFn("PUT"),
|
|
1090
|
-
request,
|
|
1091
|
-
setConfig,
|
|
1092
|
-
sse: {
|
|
1093
|
-
connect: makeSseFn("CONNECT"),
|
|
1094
|
-
delete: makeSseFn("DELETE"),
|
|
1095
|
-
get: makeSseFn("GET"),
|
|
1096
|
-
head: makeSseFn("HEAD"),
|
|
1097
|
-
options: makeSseFn("OPTIONS"),
|
|
1098
|
-
patch: makeSseFn("PATCH"),
|
|
1099
|
-
post: makeSseFn("POST"),
|
|
1100
|
-
put: makeSseFn("PUT"),
|
|
1101
|
-
trace: makeSseFn("TRACE")
|
|
1102
|
-
},
|
|
1103
|
-
trace: makeMethodFn("TRACE")
|
|
1104
|
-
};
|
|
1105
|
-
};
|
|
1106
|
-
// ../sdk/src/v1/gen/client.gen.ts
|
|
1107
|
-
var client = createClient(createConfig());
|
|
1108
|
-
|
|
1109
|
-
// ../sdk/src/v1/gen/sdk.gen.ts
|
|
1110
|
-
class HeyApiClient {
|
|
1111
|
-
client;
|
|
1112
|
-
constructor(args) {
|
|
1113
|
-
this.client = args?.client ?? client;
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
class HeyApiRegistry {
|
|
1118
|
-
defaultKey = "default";
|
|
1119
|
-
instances = new Map;
|
|
1120
|
-
get(key) {
|
|
1121
|
-
const instance = this.instances.get(key ?? this.defaultKey);
|
|
1122
|
-
if (!instance) {
|
|
1123
|
-
throw new Error(`No SDK client found. Create one with "new HighlightClient()" to fix this error.`);
|
|
1124
|
-
}
|
|
1125
|
-
return instance;
|
|
1126
|
-
}
|
|
1127
|
-
set(value, key) {
|
|
1128
|
-
this.instances.set(key ?? this.defaultKey, value);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
class Collection extends HeyApiClient {
|
|
1133
|
-
list(parameters, options) {
|
|
1134
|
-
const params = buildClientParams([parameters], [
|
|
1135
|
-
{
|
|
1136
|
-
args: [
|
|
1137
|
-
{ in: "query", key: "page" },
|
|
1138
|
-
{ in: "query", key: "limit" },
|
|
1139
|
-
{ in: "query", key: "sortBy" },
|
|
1140
|
-
{ in: "query", key: "sortDirection" },
|
|
1141
|
-
{ in: "query", key: "status" },
|
|
1142
|
-
{ in: "query", key: "blockchains" },
|
|
1143
|
-
{ in: "query", key: "testnet" },
|
|
1144
|
-
{ in: "query", key: "types" }
|
|
1145
|
-
]
|
|
1146
|
-
}
|
|
1147
|
-
]);
|
|
1148
|
-
return (options?.client ?? this.client).get({
|
|
1149
|
-
url: "/collection",
|
|
1150
|
-
...options,
|
|
1151
|
-
...params
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
create(parameters, options) {
|
|
1155
|
-
const params = buildClientParams([parameters], [
|
|
1156
|
-
{
|
|
1157
|
-
args: [
|
|
1158
|
-
{ in: "body", key: "name" },
|
|
1159
|
-
{ in: "body", key: "description" },
|
|
1160
|
-
{ in: "body", key: "contractId" },
|
|
1161
|
-
{ in: "body", key: "contract" },
|
|
1162
|
-
{ in: "body", key: "type" },
|
|
1163
|
-
{ in: "body", key: "royalty" },
|
|
1164
|
-
{ in: "body", key: "tokenManager" }
|
|
1165
|
-
]
|
|
1166
|
-
}
|
|
1167
|
-
]);
|
|
1168
|
-
return (options?.client ?? this.client).post({
|
|
1169
|
-
url: "/collection",
|
|
1170
|
-
...options,
|
|
1171
|
-
...params,
|
|
1172
|
-
headers: {
|
|
1173
|
-
"Content-Type": "application/json",
|
|
1174
|
-
...options?.headers,
|
|
1175
|
-
...params.headers
|
|
1176
|
-
}
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
discover(parameters, options) {
|
|
1180
|
-
const params = buildClientParams([parameters], [
|
|
1181
|
-
{
|
|
1182
|
-
args: [
|
|
1183
|
-
{ in: "query", key: "type" },
|
|
1184
|
-
{ in: "query", key: "chainId" },
|
|
1185
|
-
{ in: "query", key: "sort" },
|
|
1186
|
-
{ in: "query", key: "limit" },
|
|
1187
|
-
{ in: "query", key: "offset" }
|
|
1188
|
-
]
|
|
1189
|
-
}
|
|
1190
|
-
]);
|
|
1191
|
-
return (options?.client ?? this.client).get({
|
|
1192
|
-
url: "/collection/discover",
|
|
1193
|
-
...options,
|
|
1194
|
-
...params
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
trending(parameters, options) {
|
|
1198
|
-
const params = buildClientParams([parameters], [
|
|
1199
|
-
{
|
|
1200
|
-
args: [
|
|
1201
|
-
{ in: "query", key: "window" },
|
|
1202
|
-
{ in: "query", key: "chainId" },
|
|
1203
|
-
{ in: "query", key: "limit" }
|
|
1204
|
-
]
|
|
1205
|
-
}
|
|
1206
|
-
]);
|
|
1207
|
-
return (options?.client ?? this.client).get({
|
|
1208
|
-
url: "/collection/trending",
|
|
1209
|
-
...options,
|
|
1210
|
-
...params
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
featured(parameters, options) {
|
|
1214
|
-
const params = buildClientParams([parameters], [
|
|
1215
|
-
{
|
|
1216
|
-
args: [
|
|
1217
|
-
{ in: "query", key: "limit" },
|
|
1218
|
-
{ in: "query", key: "cursor" }
|
|
1219
|
-
]
|
|
1220
|
-
}
|
|
1221
|
-
]);
|
|
1222
|
-
return (options?.client ?? this.client).get({
|
|
1223
|
-
url: "/collection/featured",
|
|
1224
|
-
...options,
|
|
1225
|
-
...params
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
get(parameters, options) {
|
|
1229
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1230
|
-
return (options?.client ?? this.client).get({
|
|
1231
|
-
url: "/collection/{highlightId}",
|
|
1232
|
-
...options,
|
|
1233
|
-
...params
|
|
1234
|
-
});
|
|
1235
|
-
}
|
|
1236
|
-
listPreviews(parameters, options) {
|
|
1237
|
-
const params = buildClientParams([parameters], [
|
|
1238
|
-
{
|
|
1239
|
-
args: [
|
|
1240
|
-
{ in: "path", key: "highlightId" },
|
|
1241
|
-
{ in: "query", key: "limit" }
|
|
1242
|
-
]
|
|
1243
|
-
}
|
|
1244
|
-
]);
|
|
1245
|
-
return (options?.client ?? this.client).get({
|
|
1246
|
-
url: "/collection/{highlightId}/previews",
|
|
1247
|
-
...options,
|
|
1248
|
-
...params
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
archiveBaseUri(parameters, options) {
|
|
1252
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1253
|
-
return (options?.client ?? this.client).post({
|
|
1254
|
-
url: "/collection/{highlightId}/archive-base-uri",
|
|
1255
|
-
...options,
|
|
1256
|
-
...params
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
createMediaUploadSession(parameters, options) {
|
|
1260
|
-
const params = buildClientParams([parameters], [
|
|
1261
|
-
{
|
|
1262
|
-
args: [
|
|
1263
|
-
{ in: "path", key: "highlightId" },
|
|
1264
|
-
{ in: "body", key: "purpose" },
|
|
1265
|
-
{ in: "body", key: "fileName" },
|
|
1266
|
-
{ in: "body", key: "mimeType" },
|
|
1267
|
-
{ in: "body", key: "fileSize" },
|
|
1268
|
-
{ in: "body", key: "contentHash" }
|
|
1269
|
-
]
|
|
1270
|
-
}
|
|
1271
|
-
]);
|
|
1272
|
-
return (options?.client ?? this.client).post({
|
|
1273
|
-
url: "/collection/{highlightId}/media/upload-session",
|
|
1274
|
-
...options,
|
|
1275
|
-
...params,
|
|
1276
|
-
headers: {
|
|
1277
|
-
"Content-Type": "application/json",
|
|
1278
|
-
...options?.headers,
|
|
1279
|
-
...params.headers
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
updateMetadata(parameters, options) {
|
|
1284
|
-
const params = buildClientParams([parameters], [
|
|
1285
|
-
{
|
|
1286
|
-
args: [
|
|
1287
|
-
{ in: "path", key: "highlightId" },
|
|
1288
|
-
{ key: "collectionUpdateMetadataInput", map: "body" }
|
|
1289
|
-
]
|
|
1290
|
-
}
|
|
1291
|
-
]);
|
|
1292
|
-
return (options?.client ?? this.client).patch({
|
|
1293
|
-
url: "/collection/{highlightId}/metadata",
|
|
1294
|
-
...options,
|
|
1295
|
-
...params,
|
|
1296
|
-
headers: {
|
|
1297
|
-
"Content-Type": "application/json",
|
|
1298
|
-
...options?.headers,
|
|
1299
|
-
...params.headers
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
updateGenerativeDetails(parameters, options) {
|
|
1304
|
-
const params = buildClientParams([parameters], [
|
|
1305
|
-
{
|
|
1306
|
-
args: [
|
|
1307
|
-
{ in: "path", key: "highlightId" },
|
|
1308
|
-
{ in: "body", key: "generative" }
|
|
1309
|
-
]
|
|
1310
|
-
}
|
|
1311
|
-
]);
|
|
1312
|
-
return (options?.client ?? this.client).patch({
|
|
1313
|
-
url: "/collection/{highlightId}/details/generative",
|
|
1314
|
-
...options,
|
|
1315
|
-
...params,
|
|
1316
|
-
headers: {
|
|
1317
|
-
"Content-Type": "application/json",
|
|
1318
|
-
...options?.headers,
|
|
1319
|
-
...params.headers
|
|
1320
|
-
}
|
|
1321
|
-
});
|
|
1322
|
-
}
|
|
1323
|
-
updateSeriesDetails(parameters, options) {
|
|
1324
|
-
const params = buildClientParams([parameters], [
|
|
1325
|
-
{
|
|
1326
|
-
args: [
|
|
1327
|
-
{ in: "path", key: "highlightId" },
|
|
1328
|
-
{ in: "body", key: "series" }
|
|
1329
|
-
]
|
|
1330
|
-
}
|
|
1331
|
-
]);
|
|
1332
|
-
return (options?.client ?? this.client).patch({
|
|
1333
|
-
url: "/collection/{highlightId}/details/series",
|
|
1334
|
-
...options,
|
|
1335
|
-
...params,
|
|
1336
|
-
headers: {
|
|
1337
|
-
"Content-Type": "application/json",
|
|
1338
|
-
...options?.headers,
|
|
1339
|
-
...params.headers
|
|
1340
|
-
}
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
updateEditionDetails(parameters, options) {
|
|
1344
|
-
const params = buildClientParams([parameters], [
|
|
1345
|
-
{
|
|
1346
|
-
args: [
|
|
1347
|
-
{ in: "path", key: "highlightId" },
|
|
1348
|
-
{ in: "body", key: "edition" }
|
|
1349
|
-
]
|
|
1350
|
-
}
|
|
1351
|
-
]);
|
|
1352
|
-
return (options?.client ?? this.client).patch({
|
|
1353
|
-
url: "/collection/{highlightId}/details/edition",
|
|
1354
|
-
...options,
|
|
1355
|
-
...params,
|
|
1356
|
-
headers: {
|
|
1357
|
-
"Content-Type": "application/json",
|
|
1358
|
-
...options?.headers,
|
|
1359
|
-
...params.headers
|
|
1360
|
-
}
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
getSales(parameters, options) {
|
|
1364
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1365
|
-
return (options?.client ?? this.client).get({
|
|
1366
|
-
url: "/collection/{highlightId}/sales",
|
|
1367
|
-
...options,
|
|
1368
|
-
...params
|
|
1369
|
-
});
|
|
1370
|
-
}
|
|
1371
|
-
addSale(parameters, options) {
|
|
1372
|
-
const params = buildClientParams([parameters], [
|
|
1373
|
-
{
|
|
1374
|
-
args: [
|
|
1375
|
-
{ in: "path", key: "highlightId" },
|
|
1376
|
-
{ in: "body", key: "name" },
|
|
1377
|
-
{ in: "body", key: "type" },
|
|
1378
|
-
{ in: "body", key: "startAt" },
|
|
1379
|
-
{ in: "body", key: "endAt" },
|
|
1380
|
-
{ in: "body", key: "price" },
|
|
1381
|
-
{ in: "body", key: "currency" },
|
|
1382
|
-
{ in: "body", key: "maxPerTransaction" },
|
|
1383
|
-
{ in: "body", key: "maxPerWallet" },
|
|
1384
|
-
{ in: "body", key: "maxTotal" },
|
|
1385
|
-
{ in: "body", key: "paymentRecipient" },
|
|
1386
|
-
{ in: "body", key: "accessMode" },
|
|
1387
|
-
{ in: "body", key: "gateId" },
|
|
1388
|
-
{ in: "body", key: "mechanicId" },
|
|
1389
|
-
{ in: "body", key: "typeConfig" },
|
|
1390
|
-
{ in: "body", key: "collectorMessage" },
|
|
1391
|
-
{ in: "body", key: "customMintFee" }
|
|
1392
|
-
]
|
|
1393
|
-
}
|
|
1394
|
-
]);
|
|
1395
|
-
return (options?.client ?? this.client).post({
|
|
1396
|
-
url: "/collection/{highlightId}/sales",
|
|
1397
|
-
...options,
|
|
1398
|
-
...params,
|
|
1399
|
-
headers: {
|
|
1400
|
-
"Content-Type": "application/json",
|
|
1401
|
-
...options?.headers,
|
|
1402
|
-
...params.headers
|
|
1403
|
-
}
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
deleteSale(parameters, options) {
|
|
1407
|
-
const params = buildClientParams([parameters], [
|
|
1408
|
-
{
|
|
1409
|
-
args: [
|
|
1410
|
-
{ in: "path", key: "highlightId" },
|
|
1411
|
-
{ in: "path", key: "saleId" }
|
|
1412
|
-
]
|
|
1413
|
-
}
|
|
1414
|
-
]);
|
|
1415
|
-
return (options?.client ?? this.client).delete({
|
|
1416
|
-
url: "/collection/{highlightId}/sales/{saleId}",
|
|
1417
|
-
...options,
|
|
1418
|
-
...params
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
updateSale(parameters, options) {
|
|
1422
|
-
const params = buildClientParams([parameters], [
|
|
1423
|
-
{
|
|
1424
|
-
args: [
|
|
1425
|
-
{ in: "path", key: "highlightId" },
|
|
1426
|
-
{ in: "path", key: "saleId" },
|
|
1427
|
-
{ in: "body", key: "name" },
|
|
1428
|
-
{ in: "body", key: "startAt" },
|
|
1429
|
-
{ in: "body", key: "endAt" },
|
|
1430
|
-
{ in: "body", key: "price" },
|
|
1431
|
-
{ in: "body", key: "currency" },
|
|
1432
|
-
{ in: "body", key: "maxPerTransaction" },
|
|
1433
|
-
{ in: "body", key: "maxPerWallet" },
|
|
1434
|
-
{ in: "body", key: "maxTotal" },
|
|
1435
|
-
{ in: "body", key: "paymentRecipient" },
|
|
1436
|
-
{ in: "body", key: "paused" },
|
|
1437
|
-
{ in: "body", key: "collectorMessage" },
|
|
1438
|
-
{ in: "body", key: "customMintFee" }
|
|
1439
|
-
]
|
|
1440
|
-
}
|
|
1441
|
-
]);
|
|
1442
|
-
return (options?.client ?? this.client).patch({
|
|
1443
|
-
url: "/collection/{highlightId}/sales/{saleId}",
|
|
1444
|
-
...options,
|
|
1445
|
-
...params,
|
|
1446
|
-
headers: {
|
|
1447
|
-
"Content-Type": "application/json",
|
|
1448
|
-
...options?.headers,
|
|
1449
|
-
...params.headers
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
claimSale(parameters, options) {
|
|
1454
|
-
const params = buildClientParams([parameters], [
|
|
1455
|
-
{
|
|
1456
|
-
args: [
|
|
1457
|
-
{ in: "path", key: "highlightId" },
|
|
1458
|
-
{ in: "body", key: "saleId" },
|
|
1459
|
-
{ in: "body", key: "amount" },
|
|
1460
|
-
{ in: "body", key: "tokenIds" }
|
|
1461
|
-
]
|
|
1462
|
-
}
|
|
1463
|
-
]);
|
|
1464
|
-
return (options?.client ?? this.client).post({
|
|
1465
|
-
url: "/collection/{highlightId}/sales/claim",
|
|
1466
|
-
...options,
|
|
1467
|
-
...params,
|
|
1468
|
-
headers: {
|
|
1469
|
-
"Content-Type": "application/json",
|
|
1470
|
-
...options?.headers,
|
|
1471
|
-
...params.headers
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
bidSale(parameters, options) {
|
|
1476
|
-
const params = buildClientParams([parameters], [
|
|
1477
|
-
{
|
|
1478
|
-
args: [
|
|
1479
|
-
{ in: "path", key: "highlightId" },
|
|
1480
|
-
{ in: "body", key: "saleId" },
|
|
1481
|
-
{ in: "body", key: "bidAmount" },
|
|
1482
|
-
{ in: "body", key: "bidId" },
|
|
1483
|
-
{ in: "body", key: "preferredNftRecipient" }
|
|
1484
|
-
]
|
|
1485
|
-
}
|
|
1486
|
-
]);
|
|
1487
|
-
return (options?.client ?? this.client).post({
|
|
1488
|
-
url: "/collection/{highlightId}/sales/bid",
|
|
1489
|
-
...options,
|
|
1490
|
-
...params,
|
|
1491
|
-
headers: {
|
|
1492
|
-
"Content-Type": "application/json",
|
|
1493
|
-
...options?.headers,
|
|
1494
|
-
...params.headers
|
|
1495
|
-
}
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
reclaimBid(parameters, options) {
|
|
1499
|
-
const params = buildClientParams([parameters], [
|
|
1500
|
-
{
|
|
1501
|
-
args: [
|
|
1502
|
-
{ in: "path", key: "highlightId" },
|
|
1503
|
-
{ in: "body", key: "saleId" },
|
|
1504
|
-
{ in: "body", key: "bidId" }
|
|
1505
|
-
]
|
|
1506
|
-
}
|
|
1507
|
-
]);
|
|
1508
|
-
return (options?.client ?? this.client).post({
|
|
1509
|
-
url: "/collection/{highlightId}/sales/reclaim",
|
|
1510
|
-
...options,
|
|
1511
|
-
...params,
|
|
1512
|
-
headers: {
|
|
1513
|
-
"Content-Type": "application/json",
|
|
1514
|
-
...options?.headers,
|
|
1515
|
-
...params.headers
|
|
1516
|
-
}
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
claimAuctionEarnings(parameters, options) {
|
|
1520
|
-
const params = buildClientParams([parameters], [
|
|
1521
|
-
{
|
|
1522
|
-
args: [
|
|
1523
|
-
{ in: "path", key: "highlightId" },
|
|
1524
|
-
{ in: "body", key: "saleId" }
|
|
1525
|
-
]
|
|
1526
|
-
}
|
|
1527
|
-
]);
|
|
1528
|
-
return (options?.client ?? this.client).post({
|
|
1529
|
-
url: "/collection/{highlightId}/sales/earnings",
|
|
1530
|
-
...options,
|
|
1531
|
-
...params,
|
|
1532
|
-
headers: {
|
|
1533
|
-
"Content-Type": "application/json",
|
|
1534
|
-
...options?.headers,
|
|
1535
|
-
...params.headers
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
rankedAuctionStandings(parameters, options) {
|
|
1540
|
-
const params = buildClientParams([parameters], [
|
|
1541
|
-
{
|
|
1542
|
-
args: [
|
|
1543
|
-
{ in: "path", key: "highlightId" },
|
|
1544
|
-
{ in: "path", key: "saleId" }
|
|
1545
|
-
]
|
|
1546
|
-
}
|
|
1547
|
-
]);
|
|
1548
|
-
return (options?.client ?? this.client).get({
|
|
1549
|
-
url: "/collection/{highlightId}/sales/{saleId}/standings",
|
|
1550
|
-
...options,
|
|
1551
|
-
...params
|
|
1552
|
-
});
|
|
1553
|
-
}
|
|
1554
|
-
fulfillEnglishAuction(parameters, options) {
|
|
1555
|
-
const params = buildClientParams([parameters], [
|
|
1556
|
-
{
|
|
1557
|
-
args: [
|
|
1558
|
-
{ in: "path", key: "highlightId" },
|
|
1559
|
-
{ in: "body", key: "saleId" }
|
|
1560
|
-
]
|
|
1561
|
-
}
|
|
1562
|
-
]);
|
|
1563
|
-
return (options?.client ?? this.client).post({
|
|
1564
|
-
url: "/collection/{highlightId}/sales/auction/fulfill",
|
|
1565
|
-
...options,
|
|
1566
|
-
...params,
|
|
1567
|
-
headers: {
|
|
1568
|
-
"Content-Type": "application/json",
|
|
1569
|
-
...options?.headers,
|
|
1570
|
-
...params.headers
|
|
1571
|
-
}
|
|
1572
|
-
});
|
|
1573
|
-
}
|
|
1574
|
-
cancelEnglishAuction(parameters, options) {
|
|
1575
|
-
const params = buildClientParams([parameters], [
|
|
1576
|
-
{
|
|
1577
|
-
args: [
|
|
1578
|
-
{ in: "path", key: "highlightId" },
|
|
1579
|
-
{ in: "body", key: "saleId" }
|
|
1580
|
-
]
|
|
1581
|
-
}
|
|
1582
|
-
]);
|
|
1583
|
-
return (options?.client ?? this.client).post({
|
|
1584
|
-
url: "/collection/{highlightId}/sales/auction/cancel",
|
|
1585
|
-
...options,
|
|
1586
|
-
...params,
|
|
1587
|
-
headers: {
|
|
1588
|
-
"Content-Type": "application/json",
|
|
1589
|
-
...options?.headers,
|
|
1590
|
-
...params.headers
|
|
1591
|
-
}
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
englishAuctionStanding(parameters, options) {
|
|
1595
|
-
const params = buildClientParams([parameters], [
|
|
1596
|
-
{
|
|
1597
|
-
args: [
|
|
1598
|
-
{ in: "path", key: "highlightId" },
|
|
1599
|
-
{ in: "path", key: "saleId" }
|
|
1600
|
-
]
|
|
1601
|
-
}
|
|
1602
|
-
]);
|
|
1603
|
-
return (options?.client ?? this.client).get({
|
|
1604
|
-
url: "/collection/{highlightId}/sales/{saleId}/auction",
|
|
1605
|
-
...options,
|
|
1606
|
-
...params
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
englishAuctionBids(parameters, options) {
|
|
1610
|
-
const params = buildClientParams([parameters], [
|
|
1611
|
-
{
|
|
1612
|
-
args: [
|
|
1613
|
-
{ in: "path", key: "highlightId" },
|
|
1614
|
-
{ in: "path", key: "saleId" }
|
|
1615
|
-
]
|
|
1616
|
-
}
|
|
1617
|
-
]);
|
|
1618
|
-
return (options?.client ?? this.client).get({
|
|
1619
|
-
url: "/collection/{highlightId}/sales/{saleId}/auction/bids",
|
|
1620
|
-
...options,
|
|
1621
|
-
...params
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
dutchAuctionStanding(parameters, options) {
|
|
1625
|
-
const params = buildClientParams([parameters], [
|
|
1626
|
-
{
|
|
1627
|
-
args: [
|
|
1628
|
-
{ in: "path", key: "highlightId" },
|
|
1629
|
-
{ in: "path", key: "saleId" }
|
|
1630
|
-
]
|
|
1631
|
-
}
|
|
1632
|
-
]);
|
|
1633
|
-
return (options?.client ?? this.client).get({
|
|
1634
|
-
url: "/collection/{highlightId}/sales/{saleId}/dutch",
|
|
1635
|
-
...options,
|
|
1636
|
-
...params
|
|
1637
|
-
});
|
|
1638
|
-
}
|
|
1639
|
-
claimDutchRebate(parameters, options) {
|
|
1640
|
-
const params = buildClientParams([parameters], [
|
|
1641
|
-
{
|
|
1642
|
-
args: [
|
|
1643
|
-
{ in: "path", key: "highlightId" },
|
|
1644
|
-
{ in: "body", key: "saleId" }
|
|
1645
|
-
]
|
|
1646
|
-
}
|
|
1647
|
-
]);
|
|
1648
|
-
return (options?.client ?? this.client).post({
|
|
1649
|
-
url: "/collection/{highlightId}/sales/dutch/rebate",
|
|
1650
|
-
...options,
|
|
1651
|
-
...params,
|
|
1652
|
-
headers: {
|
|
1653
|
-
"Content-Type": "application/json",
|
|
1654
|
-
...options?.headers,
|
|
1655
|
-
...params.headers
|
|
1656
|
-
}
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
1659
|
-
deploy(parameters, options) {
|
|
1660
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1661
|
-
return (options?.client ?? this.client).post({
|
|
1662
|
-
url: "/collection/{highlightId}/deploy",
|
|
1663
|
-
...options,
|
|
1664
|
-
...params
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
deployStatus(parameters, options) {
|
|
1668
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1669
|
-
return (options?.client ?? this.client).get({
|
|
1670
|
-
url: "/collection/{highlightId}/deploy/status",
|
|
1671
|
-
...options,
|
|
1672
|
-
...params
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
deployCancel(parameters, options) {
|
|
1676
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1677
|
-
return (options?.client ?? this.client).post({
|
|
1678
|
-
url: "/collection/{highlightId}/deploy/cancel",
|
|
1679
|
-
...options,
|
|
1680
|
-
...params
|
|
1681
|
-
});
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
class Token extends HeyApiClient {
|
|
1686
|
-
list(parameters, options) {
|
|
1687
|
-
const params = buildClientParams([parameters], [
|
|
1688
|
-
{
|
|
1689
|
-
args: [
|
|
1690
|
-
{ in: "path", key: "highlightId" },
|
|
1691
|
-
{ in: "query", key: "page" },
|
|
1692
|
-
{ in: "query", key: "limit" },
|
|
1693
|
-
{ in: "query", key: "sort" },
|
|
1694
|
-
{ in: "query", key: "order" },
|
|
1695
|
-
{ in: "query", key: "ownerAddress" },
|
|
1696
|
-
{ in: "query", key: "search" },
|
|
1697
|
-
{ in: "query", key: "attributes" }
|
|
1698
|
-
]
|
|
1699
|
-
}
|
|
1700
|
-
]);
|
|
1701
|
-
return (options?.client ?? this.client).get({
|
|
1702
|
-
url: "/collection/{highlightId}/tokens",
|
|
1703
|
-
...options,
|
|
1704
|
-
...params
|
|
1705
|
-
});
|
|
1706
|
-
}
|
|
1707
|
-
attributeFacets(parameters, options) {
|
|
1708
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1709
|
-
return (options?.client ?? this.client).get({
|
|
1710
|
-
url: "/collection/{highlightId}/tokens/attributes",
|
|
1711
|
-
...options,
|
|
1712
|
-
...params
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
get(parameters, options) {
|
|
1716
|
-
const params = buildClientParams([parameters], [
|
|
1717
|
-
{
|
|
1718
|
-
args: [
|
|
1719
|
-
{ in: "path", key: "highlightId" },
|
|
1720
|
-
{ in: "path", key: "tokenId" }
|
|
1721
|
-
]
|
|
1722
|
-
}
|
|
1723
|
-
]);
|
|
1724
|
-
return (options?.client ?? this.client).get({
|
|
1725
|
-
url: "/collection/{highlightId}/tokens/{tokenId}",
|
|
1726
|
-
...options,
|
|
1727
|
-
...params
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
listOwners(parameters, options) {
|
|
1731
|
-
const params = buildClientParams([parameters], [
|
|
1732
|
-
{
|
|
1733
|
-
args: [
|
|
1734
|
-
{ in: "path", key: "highlightId" },
|
|
1735
|
-
{ in: "path", key: "tokenId" }
|
|
1736
|
-
]
|
|
1737
|
-
}
|
|
1738
|
-
]);
|
|
1739
|
-
return (options?.client ?? this.client).get({
|
|
1740
|
-
url: "/collection/{highlightId}/tokens/{tokenId}/owners",
|
|
1741
|
-
...options,
|
|
1742
|
-
...params
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
redriveReveals(parameters, options) {
|
|
1746
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "highlightId" }] }]);
|
|
1747
|
-
return (options?.client ?? this.client).post({
|
|
1748
|
-
url: "/collection/{highlightId}/tokens/redrive-reveals",
|
|
1749
|
-
...options,
|
|
1750
|
-
...params
|
|
1751
|
-
});
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
class Config extends HeyApiClient {
|
|
1756
|
-
chains(options) {
|
|
1757
|
-
return (options?.client ?? this.client).get({
|
|
1758
|
-
url: "/config/chains",
|
|
1759
|
-
...options
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
mediaHosts(options) {
|
|
1763
|
-
return (options?.client ?? this.client).get({
|
|
1764
|
-
url: "/config/media-hosts",
|
|
1765
|
-
...options
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
systemContract(parameters, options) {
|
|
1769
|
-
const params = buildClientParams([parameters], [
|
|
1770
|
-
{
|
|
1771
|
-
args: [
|
|
1772
|
-
{ in: "query", key: "chainId" },
|
|
1773
|
-
{ in: "query", key: "type" }
|
|
1774
|
-
]
|
|
1775
|
-
}
|
|
1776
|
-
]);
|
|
1777
|
-
return (options?.client ?? this.client).get({
|
|
1778
|
-
url: "/config/system-contract",
|
|
1779
|
-
...options,
|
|
1780
|
-
...params
|
|
1781
|
-
});
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
class Contract extends HeyApiClient {
|
|
1786
|
-
list(parameters, options) {
|
|
1787
|
-
const params = buildClientParams([parameters], [
|
|
1788
|
-
{
|
|
1789
|
-
args: [
|
|
1790
|
-
{ in: "query", key: "limit" },
|
|
1791
|
-
{ in: "query", key: "cursor" }
|
|
1792
|
-
]
|
|
1793
|
-
}
|
|
1794
|
-
]);
|
|
1795
|
-
return (options?.client ?? this.client).get({
|
|
1796
|
-
url: "/contract",
|
|
1797
|
-
...options,
|
|
1798
|
-
...params
|
|
1799
|
-
});
|
|
1800
|
-
}
|
|
1801
|
-
get(parameters, options) {
|
|
1802
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "contractId" }] }]);
|
|
1803
|
-
return (options?.client ?? this.client).get({
|
|
1804
|
-
url: "/contract/{contractId}",
|
|
1805
|
-
...options,
|
|
1806
|
-
...params
|
|
1807
|
-
});
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
class Gate extends HeyApiClient {
|
|
1812
|
-
list(options) {
|
|
1813
|
-
return (options?.client ?? this.client).get({
|
|
1814
|
-
url: "/gate",
|
|
1815
|
-
...options
|
|
1816
|
-
});
|
|
1817
|
-
}
|
|
1818
|
-
create(parameters, options) {
|
|
1819
|
-
const params = buildClientParams([parameters], [
|
|
1820
|
-
{
|
|
1821
|
-
args: [
|
|
1822
|
-
{ in: "body", key: "name" },
|
|
1823
|
-
{ in: "body", key: "matchMode" },
|
|
1824
|
-
{ in: "body", key: "conditions" }
|
|
1825
|
-
]
|
|
1826
|
-
}
|
|
1827
|
-
]);
|
|
1828
|
-
return (options?.client ?? this.client).post({
|
|
1829
|
-
url: "/gate",
|
|
1830
|
-
...options,
|
|
1831
|
-
...params,
|
|
1832
|
-
headers: {
|
|
1833
|
-
"Content-Type": "application/json",
|
|
1834
|
-
...options?.headers,
|
|
1835
|
-
...params.headers
|
|
1836
|
-
}
|
|
1837
|
-
});
|
|
1838
|
-
}
|
|
1839
|
-
remove(parameters, options) {
|
|
1840
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "gateId" }] }]);
|
|
1841
|
-
return (options?.client ?? this.client).delete({
|
|
1842
|
-
url: "/gate/{gateId}",
|
|
1843
|
-
...options,
|
|
1844
|
-
...params
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
get(parameters, options) {
|
|
1848
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "gateId" }] }]);
|
|
1849
|
-
return (options?.client ?? this.client).get({
|
|
1850
|
-
url: "/gate/{gateId}",
|
|
1851
|
-
...options,
|
|
1852
|
-
...params
|
|
1853
|
-
});
|
|
1854
|
-
}
|
|
1855
|
-
update(parameters, options) {
|
|
1856
|
-
const params = buildClientParams([parameters], [
|
|
1857
|
-
{
|
|
1858
|
-
args: [
|
|
1859
|
-
{ in: "path", key: "gateId" },
|
|
1860
|
-
{ in: "body", key: "name" },
|
|
1861
|
-
{ in: "body", key: "matchMode" },
|
|
1862
|
-
{ in: "body", key: "conditions" }
|
|
1863
|
-
]
|
|
1864
|
-
}
|
|
1865
|
-
]);
|
|
1866
|
-
return (options?.client ?? this.client).patch({
|
|
1867
|
-
url: "/gate/{gateId}",
|
|
1868
|
-
...options,
|
|
1869
|
-
...params,
|
|
1870
|
-
headers: {
|
|
1871
|
-
"Content-Type": "application/json",
|
|
1872
|
-
...options?.headers,
|
|
1873
|
-
...params.headers
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
previewCollection(parameters, options) {
|
|
1878
|
-
const params = buildClientParams([parameters], [
|
|
1879
|
-
{
|
|
1880
|
-
args: [
|
|
1881
|
-
{ in: "path", key: "chainId" },
|
|
1882
|
-
{ in: "path", key: "address" }
|
|
1883
|
-
]
|
|
1884
|
-
}
|
|
1885
|
-
]);
|
|
1886
|
-
return (options?.client ?? this.client).get({
|
|
1887
|
-
url: "/gate/preview/collection/{chainId}/{address}",
|
|
1888
|
-
...options,
|
|
1889
|
-
...params
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
previewAttributes(parameters, options) {
|
|
1893
|
-
const params = buildClientParams([parameters], [
|
|
1894
|
-
{
|
|
1895
|
-
args: [
|
|
1896
|
-
{ in: "path", key: "chainId" },
|
|
1897
|
-
{ in: "path", key: "address" }
|
|
1898
|
-
]
|
|
1899
|
-
}
|
|
1900
|
-
]);
|
|
1901
|
-
return (options?.client ?? this.client).get({
|
|
1902
|
-
url: "/gate/preview/collection/{chainId}/{address}/attributes",
|
|
1903
|
-
...options,
|
|
1904
|
-
...params
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
previewTokens(parameters, options) {
|
|
1908
|
-
const params = buildClientParams([parameters], [
|
|
1909
|
-
{
|
|
1910
|
-
args: [
|
|
1911
|
-
{ in: "path", key: "chainId" },
|
|
1912
|
-
{ in: "path", key: "address" },
|
|
1913
|
-
{ in: "query", key: "cursor" },
|
|
1914
|
-
{ in: "query", key: "limit" }
|
|
1915
|
-
]
|
|
1916
|
-
}
|
|
1917
|
-
]);
|
|
1918
|
-
return (options?.client ?? this.client).get({
|
|
1919
|
-
url: "/gate/preview/collection/{chainId}/{address}/tokens",
|
|
1920
|
-
...options,
|
|
1921
|
-
...params
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
previewToken(parameters, options) {
|
|
1925
|
-
const params = buildClientParams([parameters], [
|
|
1926
|
-
{
|
|
1927
|
-
args: [
|
|
1928
|
-
{ in: "path", key: "chainId" },
|
|
1929
|
-
{ in: "path", key: "address" },
|
|
1930
|
-
{ in: "path", key: "tokenId" }
|
|
1931
|
-
]
|
|
1932
|
-
}
|
|
1933
|
-
]);
|
|
1934
|
-
return (options?.client ?? this.client).get({
|
|
1935
|
-
url: "/gate/preview/collection/{chainId}/{address}/token/{tokenId}",
|
|
1936
|
-
...options,
|
|
1937
|
-
...params
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
previewCurrency(parameters, options) {
|
|
1941
|
-
const params = buildClientParams([parameters], [
|
|
1942
|
-
{
|
|
1943
|
-
args: [
|
|
1944
|
-
{ in: "path", key: "chainId" },
|
|
1945
|
-
{ in: "query", key: "contractAddress" }
|
|
1946
|
-
]
|
|
1947
|
-
}
|
|
1948
|
-
]);
|
|
1949
|
-
return (options?.client ?? this.client).get({
|
|
1950
|
-
url: "/gate/preview/currency/{chainId}",
|
|
1951
|
-
...options,
|
|
1952
|
-
...params
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
previewFarcaster(parameters, options) {
|
|
1956
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "query" }] }]);
|
|
1957
|
-
return (options?.client ?? this.client).get({
|
|
1958
|
-
url: "/gate/preview/farcaster/user",
|
|
1959
|
-
...options,
|
|
1960
|
-
...params
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
class Mechanic extends HeyApiClient {
|
|
1966
|
-
list(parameters, options) {
|
|
1967
|
-
const params = buildClientParams([parameters], [
|
|
1968
|
-
{
|
|
1969
|
-
args: [
|
|
1970
|
-
{ in: "query", key: "builtIn" },
|
|
1971
|
-
{ in: "query", key: "type" }
|
|
1972
|
-
]
|
|
1973
|
-
}
|
|
1974
|
-
]);
|
|
1975
|
-
return (options?.client ?? this.client).get({
|
|
1976
|
-
url: "/mechanic",
|
|
1977
|
-
...options,
|
|
1978
|
-
...params
|
|
1979
|
-
});
|
|
1980
|
-
}
|
|
1981
|
-
create(parameters, options) {
|
|
1982
|
-
const params = buildClientParams([parameters], [
|
|
1983
|
-
{
|
|
1984
|
-
args: [
|
|
1985
|
-
{ in: "body", key: "slug" },
|
|
1986
|
-
{ in: "body", key: "name" },
|
|
1987
|
-
{ in: "body", key: "description" },
|
|
1988
|
-
{ in: "body", key: "configSchema" },
|
|
1989
|
-
{ in: "body", key: "encodingAbi" }
|
|
1990
|
-
]
|
|
1991
|
-
}
|
|
1992
|
-
]);
|
|
1993
|
-
return (options?.client ?? this.client).post({
|
|
1994
|
-
url: "/mechanic",
|
|
1995
|
-
...options,
|
|
1996
|
-
...params,
|
|
1997
|
-
headers: {
|
|
1998
|
-
"Content-Type": "application/json",
|
|
1999
|
-
...options?.headers,
|
|
2000
|
-
...params.headers
|
|
2001
|
-
}
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
get(parameters, options) {
|
|
2005
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "mechanicId" }] }]);
|
|
2006
|
-
return (options?.client ?? this.client).get({
|
|
2007
|
-
url: "/mechanic/{mechanicId}",
|
|
2008
|
-
...options,
|
|
2009
|
-
...params
|
|
2010
|
-
});
|
|
2011
|
-
}
|
|
2012
|
-
update(parameters, options) {
|
|
2013
|
-
const params = buildClientParams([parameters], [
|
|
2014
|
-
{
|
|
2015
|
-
args: [
|
|
2016
|
-
{ in: "path", key: "mechanicId" },
|
|
2017
|
-
{ in: "body", key: "name" },
|
|
2018
|
-
{ in: "body", key: "description" },
|
|
2019
|
-
{ in: "body", key: "configSchema" },
|
|
2020
|
-
{ in: "body", key: "encodingAbi" }
|
|
2021
|
-
]
|
|
2022
|
-
}
|
|
2023
|
-
]);
|
|
2024
|
-
return (options?.client ?? this.client).patch({
|
|
2025
|
-
url: "/mechanic/{mechanicId}",
|
|
2026
|
-
...options,
|
|
2027
|
-
...params,
|
|
2028
|
-
headers: {
|
|
2029
|
-
"Content-Type": "application/json",
|
|
2030
|
-
...options?.headers,
|
|
2031
|
-
...params.headers
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
removeDeployment(parameters, options) {
|
|
2036
|
-
const params = buildClientParams([parameters], [
|
|
2037
|
-
{
|
|
2038
|
-
args: [
|
|
2039
|
-
{ in: "path", key: "mechanicId" },
|
|
2040
|
-
{ in: "body", key: "chainId" }
|
|
2041
|
-
]
|
|
2042
|
-
}
|
|
2043
|
-
]);
|
|
2044
|
-
return (options?.client ?? this.client).delete({
|
|
2045
|
-
url: "/mechanic/{mechanicId}/deployment",
|
|
2046
|
-
...options,
|
|
2047
|
-
...params,
|
|
2048
|
-
headers: {
|
|
2049
|
-
"Content-Type": "application/json",
|
|
2050
|
-
...options?.headers,
|
|
2051
|
-
...params.headers
|
|
2052
|
-
}
|
|
2053
|
-
});
|
|
2054
|
-
}
|
|
2055
|
-
addDeployment(parameters, options) {
|
|
2056
|
-
const params = buildClientParams([parameters], [
|
|
2057
|
-
{
|
|
2058
|
-
args: [
|
|
2059
|
-
{ in: "path", key: "mechanicId" },
|
|
2060
|
-
{ in: "body", key: "chainId" },
|
|
2061
|
-
{ in: "body", key: "address" }
|
|
2062
|
-
]
|
|
2063
|
-
}
|
|
2064
|
-
]);
|
|
2065
|
-
return (options?.client ?? this.client).post({
|
|
2066
|
-
url: "/mechanic/{mechanicId}/deployment",
|
|
2067
|
-
...options,
|
|
2068
|
-
...params,
|
|
2069
|
-
headers: {
|
|
2070
|
-
"Content-Type": "application/json",
|
|
2071
|
-
...options?.headers,
|
|
2072
|
-
...params.headers
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
class Media extends HeyApiClient {
|
|
2079
|
-
finalizeUpload(parameters, options) {
|
|
2080
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "mediaId" }] }]);
|
|
2081
|
-
return (options?.client ?? this.client).post({
|
|
2082
|
-
url: "/media/{mediaId}/finalize",
|
|
2083
|
-
...options,
|
|
2084
|
-
...params
|
|
2085
|
-
});
|
|
2086
|
-
}
|
|
2087
|
-
listChildren(parameters, options) {
|
|
2088
|
-
const params = buildClientParams([parameters], [
|
|
2089
|
-
{
|
|
2090
|
-
args: [
|
|
2091
|
-
{ in: "path", key: "mediaId" },
|
|
2092
|
-
{ in: "query", key: "cursor" },
|
|
2093
|
-
{ in: "query", key: "limit" }
|
|
2094
|
-
]
|
|
2095
|
-
}
|
|
2096
|
-
]);
|
|
2097
|
-
return (options?.client ?? this.client).get({
|
|
2098
|
-
url: "/media/{mediaId}/children",
|
|
2099
|
-
...options,
|
|
2100
|
-
...params
|
|
2101
|
-
});
|
|
2102
|
-
}
|
|
2103
|
-
delete(parameters, options) {
|
|
2104
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "mediaId" }] }]);
|
|
2105
|
-
return (options?.client ?? this.client).delete({
|
|
2106
|
-
url: "/media/{mediaId}",
|
|
2107
|
-
...options,
|
|
2108
|
-
...params
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
get(parameters, options) {
|
|
2112
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "mediaId" }] }]);
|
|
2113
|
-
return (options?.client ?? this.client).get({
|
|
2114
|
-
url: "/media/{mediaId}",
|
|
2115
|
-
...options,
|
|
2116
|
-
...params
|
|
2117
|
-
});
|
|
2118
|
-
}
|
|
2119
|
-
publish(parameters, options) {
|
|
2120
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "mediaId" }] }]);
|
|
2121
|
-
return (options?.client ?? this.client).post({
|
|
2122
|
-
url: "/media/{mediaId}/publish",
|
|
2123
|
-
...options,
|
|
2124
|
-
...params
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
getChild(parameters, options) {
|
|
2128
|
-
const params = buildClientParams([parameters], [
|
|
2129
|
-
{
|
|
2130
|
-
args: [
|
|
2131
|
-
{ in: "path", key: "mediaId" },
|
|
2132
|
-
{ in: "path", key: "path" }
|
|
2133
|
-
]
|
|
2134
|
-
}
|
|
2135
|
-
]);
|
|
2136
|
-
return (options?.client ?? this.client).get({
|
|
2137
|
-
url: "/media/{mediaId}/children/{path}",
|
|
2138
|
-
...options,
|
|
2139
|
-
...params
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
class Tx extends HeyApiClient {
|
|
2145
|
-
status(parameters, options) {
|
|
2146
|
-
const params = buildClientParams([parameters], [
|
|
2147
|
-
{
|
|
2148
|
-
args: [
|
|
2149
|
-
{ in: "path", key: "chainId" },
|
|
2150
|
-
{ in: "path", key: "txHash" }
|
|
2151
|
-
]
|
|
2152
|
-
}
|
|
2153
|
-
]);
|
|
2154
|
-
return (options?.client ?? this.client).get({
|
|
2155
|
-
url: "/tx/{chainId}/{txHash}",
|
|
2156
|
-
...options,
|
|
2157
|
-
...params
|
|
2158
|
-
});
|
|
2159
|
-
}
|
|
2160
|
-
submit(parameters, options) {
|
|
2161
|
-
const params = buildClientParams([parameters], [
|
|
2162
|
-
{
|
|
2163
|
-
args: [
|
|
2164
|
-
{ in: "path", key: "chainId" },
|
|
2165
|
-
{ in: "path", key: "txHash" }
|
|
2166
|
-
]
|
|
2167
|
-
}
|
|
2168
|
-
]);
|
|
2169
|
-
return (options?.client ?? this.client).post({
|
|
2170
|
-
url: "/tx/{chainId}/{txHash}",
|
|
2171
|
-
...options,
|
|
2172
|
-
...params
|
|
2173
|
-
});
|
|
16
|
+
bin: {
|
|
17
|
+
hl: "./lib/index.js"
|
|
18
|
+
},
|
|
19
|
+
files: [
|
|
20
|
+
"lib",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
type: "module",
|
|
24
|
+
publishConfig: {
|
|
25
|
+
access: "public"
|
|
26
|
+
},
|
|
27
|
+
scripts: {
|
|
28
|
+
build: "bun build ./src/index.ts --outfile ./lib/index.js --target node --format esm --external @highlightxyz/sdk",
|
|
29
|
+
"ts-check": "bunx --bun tsgo --noEmit -p tsconfig.json",
|
|
30
|
+
test: "bun test",
|
|
31
|
+
lint: "oxlint ./src",
|
|
32
|
+
"lint:fix": "oxlint --fix --quiet ./src",
|
|
33
|
+
format: 'oxfmt --check --no-error-on-unmatched-pattern "./src/**/*.{js,jsx,ts,tsx,mjs,cjs}"',
|
|
34
|
+
"format:fix": 'oxfmt --write --no-error-on-unmatched-pattern "./src/**/*.{js,jsx,ts,tsx,mjs,cjs}"',
|
|
35
|
+
prepublishOnly: "bun run build"
|
|
36
|
+
},
|
|
37
|
+
dependencies: {
|
|
38
|
+
"@highlightxyz/sdk": "^0.11.0"
|
|
39
|
+
},
|
|
40
|
+
devDependencies: {
|
|
41
|
+
"@types/bun": "^1.3.9",
|
|
42
|
+
"@types/node": "^25.3.2"
|
|
43
|
+
},
|
|
44
|
+
engines: {
|
|
45
|
+
node: ">=20"
|
|
46
|
+
},
|
|
47
|
+
bugs: {
|
|
48
|
+
url: "https://docs.highlight.xyz/reference/support/"
|
|
2174
49
|
}
|
|
2175
|
-
}
|
|
50
|
+
};
|
|
2176
51
|
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
return (options?.client ?? this.client).post({ url: "/user/signin/siwe/nonce", ...options });
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
52
|
+
// src/args.ts
|
|
53
|
+
import { parseArgs } from "node:util";
|
|
2182
54
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
{ in: "body", key: "mimeType" },
|
|
2191
|
-
{ in: "body", key: "fileSize" },
|
|
2192
|
-
{ in: "body", key: "contentHash" }
|
|
2193
|
-
]
|
|
2194
|
-
}
|
|
2195
|
-
]);
|
|
2196
|
-
return (options?.client ?? this.client).post({
|
|
2197
|
-
url: "/user/media/upload-session",
|
|
2198
|
-
...options,
|
|
2199
|
-
...params,
|
|
2200
|
-
headers: {
|
|
2201
|
-
"Content-Type": "application/json",
|
|
2202
|
-
...options?.headers,
|
|
2203
|
-
...params.headers
|
|
2204
|
-
}
|
|
2205
|
-
});
|
|
2206
|
-
}
|
|
2207
|
-
signin(parameters, options) {
|
|
2208
|
-
const params = buildClientParams([parameters], [{ args: [{ key: "body", map: "body" }] }]);
|
|
2209
|
-
return (options?.client ?? this.client).post({
|
|
2210
|
-
url: "/user/signin",
|
|
2211
|
-
...options,
|
|
2212
|
-
...params,
|
|
2213
|
-
headers: {
|
|
2214
|
-
"Content-Type": "application/json",
|
|
2215
|
-
...options?.headers,
|
|
2216
|
-
...params.headers
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2219
|
-
}
|
|
2220
|
-
_siwe;
|
|
2221
|
-
get siwe() {
|
|
2222
|
-
return this._siwe ??= new Siwe({ client: this.client });
|
|
55
|
+
// src/errors.ts
|
|
56
|
+
class CliError extends Error {
|
|
57
|
+
exitCode;
|
|
58
|
+
constructor(message, exitCode = 1) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = "CliError";
|
|
61
|
+
this.exitCode = exitCode;
|
|
2223
62
|
}
|
|
2224
63
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
return
|
|
2229
|
-
}
|
|
2230
|
-
update(parameters, options) {
|
|
2231
|
-
const params = buildClientParams([parameters], [
|
|
2232
|
-
{
|
|
2233
|
-
args: [
|
|
2234
|
-
{ in: "body", key: "displayName" },
|
|
2235
|
-
{ in: "body", key: "bio" },
|
|
2236
|
-
{ in: "body", key: "website" },
|
|
2237
|
-
{ in: "body", key: "avatarMediaId" }
|
|
2238
|
-
]
|
|
2239
|
-
}
|
|
2240
|
-
]);
|
|
2241
|
-
return (options?.client ?? this.client).patch({
|
|
2242
|
-
url: "/user/profile",
|
|
2243
|
-
...options,
|
|
2244
|
-
...params,
|
|
2245
|
-
headers: {
|
|
2246
|
-
"Content-Type": "application/json",
|
|
2247
|
-
...options?.headers,
|
|
2248
|
-
...params.headers
|
|
2249
|
-
}
|
|
2250
|
-
});
|
|
2251
|
-
}
|
|
2252
|
-
artists(parameters, options) {
|
|
2253
|
-
const params = buildClientParams([parameters], [
|
|
2254
|
-
{
|
|
2255
|
-
args: [
|
|
2256
|
-
{ in: "query", key: "search" },
|
|
2257
|
-
{ in: "query", key: "sort" },
|
|
2258
|
-
{ in: "query", key: "limit" },
|
|
2259
|
-
{ in: "query", key: "offset" }
|
|
2260
|
-
]
|
|
2261
|
-
}
|
|
2262
|
-
]);
|
|
2263
|
-
return (options?.client ?? this.client).get({
|
|
2264
|
-
url: "/user/artists",
|
|
2265
|
-
...options,
|
|
2266
|
-
...params
|
|
2267
|
-
});
|
|
2268
|
-
}
|
|
2269
|
-
artistSpotlight(parameters, options) {
|
|
2270
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "surface" }] }]);
|
|
2271
|
-
return (options?.client ?? this.client).get({
|
|
2272
|
-
url: "/user/artists/spotlight",
|
|
2273
|
-
...options,
|
|
2274
|
-
...params
|
|
2275
|
-
});
|
|
2276
|
-
}
|
|
2277
|
-
public(parameters, options) {
|
|
2278
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "walletAddress" }] }]);
|
|
2279
|
-
return (options?.client ?? this.client).get({
|
|
2280
|
-
url: "/user/{walletAddress}/profile",
|
|
2281
|
-
...options,
|
|
2282
|
-
...params
|
|
2283
|
-
});
|
|
64
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65
|
+
var errorMessage = (error) => {
|
|
66
|
+
if (typeof error === "string" && error.length > 0) {
|
|
67
|
+
return error;
|
|
2284
68
|
}
|
|
2285
|
-
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
{ in: "query", key: "page" },
|
|
2291
|
-
{ in: "query", key: "limit" },
|
|
2292
|
-
{ in: "query", key: "sort" },
|
|
2293
|
-
{ in: "query", key: "order" },
|
|
2294
|
-
{ in: "query", key: "collectionId" },
|
|
2295
|
-
{ in: "query", key: "search" }
|
|
2296
|
-
]
|
|
69
|
+
if (isRecord(error)) {
|
|
70
|
+
for (const key of ["message", "error", "name"]) {
|
|
71
|
+
const value = error[key];
|
|
72
|
+
if (typeof value === "string" && value.length > 0) {
|
|
73
|
+
return value;
|
|
2297
74
|
}
|
|
2298
|
-
|
|
2299
|
-
return (
|
|
2300
|
-
url: "/user/{walletAddress}/tokens",
|
|
2301
|
-
...options,
|
|
2302
|
-
...params
|
|
2303
|
-
});
|
|
75
|
+
}
|
|
76
|
+
return JSON.stringify(error);
|
|
2304
77
|
}
|
|
2305
|
-
|
|
78
|
+
return "Unknown API error";
|
|
79
|
+
};
|
|
2306
80
|
|
|
2307
|
-
class
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
{ in: "body", key: "name" },
|
|
2316
|
-
{ in: "body", key: "expiresAt" }
|
|
2317
|
-
]
|
|
2318
|
-
}
|
|
2319
|
-
]);
|
|
2320
|
-
return (options?.client ?? this.client).post({
|
|
2321
|
-
url: "/user/api-keys",
|
|
2322
|
-
...options,
|
|
2323
|
-
...params,
|
|
2324
|
-
headers: {
|
|
2325
|
-
"Content-Type": "application/json",
|
|
2326
|
-
...options?.headers,
|
|
2327
|
-
...params.headers
|
|
2328
|
-
}
|
|
2329
|
-
});
|
|
2330
|
-
}
|
|
2331
|
-
revoke(parameters, options) {
|
|
2332
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "apiKeyId" }] }]);
|
|
2333
|
-
return (options?.client ?? this.client).delete({
|
|
2334
|
-
url: "/user/api-keys/{apiKeyId}",
|
|
2335
|
-
...options,
|
|
2336
|
-
...params
|
|
2337
|
-
});
|
|
81
|
+
class ApiError extends CliError {
|
|
82
|
+
status;
|
|
83
|
+
details;
|
|
84
|
+
constructor(error, status) {
|
|
85
|
+
super(status ? `Highlight API returned ${status}: ${errorMessage(error)}` : errorMessage(error));
|
|
86
|
+
this.name = "ApiError";
|
|
87
|
+
this.status = status;
|
|
88
|
+
this.details = error;
|
|
2338
89
|
}
|
|
2339
90
|
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
return (options?.client ?? this.client).get({
|
|
2344
|
-
url: "/health",
|
|
2345
|
-
...options
|
|
2346
|
-
});
|
|
91
|
+
var unwrap = (result) => {
|
|
92
|
+
if (result.data !== undefined) {
|
|
93
|
+
return result.data;
|
|
2347
94
|
}
|
|
2348
|
-
|
|
95
|
+
throw new ApiError(result.error, result.response?.status);
|
|
96
|
+
};
|
|
97
|
+
var toErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
2349
98
|
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
}
|
|
2356
|
-
getIndexerStatus(options) {
|
|
2357
|
-
return (options?.client ?? this.client).get({ url: "/indexer/status", ...options });
|
|
2358
|
-
}
|
|
2359
|
-
postIndexerChainsByChainIdActivate(parameters, options) {
|
|
2360
|
-
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "chainId" }] }]);
|
|
2361
|
-
return (options?.client ?? this.client).post({
|
|
2362
|
-
url: "/indexer/chains/{chainId}/activate",
|
|
2363
|
-
...options,
|
|
2364
|
-
...params
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
2367
|
-
postIndexerChainsByChainIdReset(parameters, options) {
|
|
2368
|
-
const params = buildClientParams([parameters], [
|
|
2369
|
-
{
|
|
2370
|
-
args: [
|
|
2371
|
-
{ in: "path", key: "chainId" },
|
|
2372
|
-
{ in: "body", key: "blockNumber" }
|
|
2373
|
-
]
|
|
2374
|
-
}
|
|
2375
|
-
]);
|
|
2376
|
-
return (options?.client ?? this.client).post({
|
|
2377
|
-
url: "/indexer/chains/{chainId}/reset",
|
|
2378
|
-
...options,
|
|
2379
|
-
...params,
|
|
2380
|
-
headers: {
|
|
2381
|
-
"Content-Type": "application/json",
|
|
2382
|
-
...options?.headers,
|
|
2383
|
-
...params.headers
|
|
2384
|
-
}
|
|
2385
|
-
});
|
|
2386
|
-
}
|
|
2387
|
-
_collection;
|
|
2388
|
-
get collection() {
|
|
2389
|
-
return this._collection ??= new Collection({ client: this.client });
|
|
2390
|
-
}
|
|
2391
|
-
_token;
|
|
2392
|
-
get token() {
|
|
2393
|
-
return this._token ??= new Token({ client: this.client });
|
|
2394
|
-
}
|
|
2395
|
-
_config;
|
|
2396
|
-
get config() {
|
|
2397
|
-
return this._config ??= new Config({ client: this.client });
|
|
2398
|
-
}
|
|
2399
|
-
_contract;
|
|
2400
|
-
get contract() {
|
|
2401
|
-
return this._contract ??= new Contract({ client: this.client });
|
|
2402
|
-
}
|
|
2403
|
-
_gate;
|
|
2404
|
-
get gate() {
|
|
2405
|
-
return this._gate ??= new Gate({ client: this.client });
|
|
2406
|
-
}
|
|
2407
|
-
_mechanic;
|
|
2408
|
-
get mechanic() {
|
|
2409
|
-
return this._mechanic ??= new Mechanic({ client: this.client });
|
|
2410
|
-
}
|
|
2411
|
-
_media;
|
|
2412
|
-
get media() {
|
|
2413
|
-
return this._media ??= new Media({ client: this.client });
|
|
2414
|
-
}
|
|
2415
|
-
_tx;
|
|
2416
|
-
get tx() {
|
|
2417
|
-
return this._tx ??= new Tx({ client: this.client });
|
|
2418
|
-
}
|
|
2419
|
-
_user;
|
|
2420
|
-
get user() {
|
|
2421
|
-
return this._user ??= new User({ client: this.client });
|
|
2422
|
-
}
|
|
2423
|
-
_profile;
|
|
2424
|
-
get profile() {
|
|
2425
|
-
return this._profile ??= new Profile({ client: this.client });
|
|
2426
|
-
}
|
|
2427
|
-
_apiKey;
|
|
2428
|
-
get apiKey() {
|
|
2429
|
-
return this._apiKey ??= new ApiKey({ client: this.client });
|
|
99
|
+
// src/args.ts
|
|
100
|
+
var optionValue = (args, index, option) => {
|
|
101
|
+
const inline = args[index]?.match(new RegExp(`^${option}=(.+)$`))?.[1];
|
|
102
|
+
if (inline !== undefined) {
|
|
103
|
+
return [inline, index];
|
|
2430
104
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
105
|
+
const value = args[index + 1];
|
|
106
|
+
if (!value || value.startsWith("-")) {
|
|
107
|
+
throw new CliError(`${option} requires a value`, 2);
|
|
2434
108
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
security: config?.security ?? (config?.auth || config?.apiKey ? [{ type: "http", scheme: "bearer" }] : undefined)
|
|
109
|
+
return [value, index + 1];
|
|
110
|
+
};
|
|
111
|
+
var extractGlobalOptions = (args) => {
|
|
112
|
+
const global = {
|
|
113
|
+
help: false,
|
|
114
|
+
json: false,
|
|
115
|
+
version: false
|
|
2443
116
|
};
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
}
|
|
2464
|
-
function aoutput(out, instance) {
|
|
2465
|
-
abytes(out);
|
|
2466
|
-
const min = instance.outputLen;
|
|
2467
|
-
if (out.length < min) {
|
|
2468
|
-
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
function clean(...arrays) {
|
|
2472
|
-
for (let i = 0;i < arrays.length; i++) {
|
|
2473
|
-
arrays[i].fill(0);
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
function createView(arr) {
|
|
2477
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
2478
|
-
}
|
|
2479
|
-
function rotr(word, shift) {
|
|
2480
|
-
return word << 32 - shift | word >>> shift;
|
|
2481
|
-
}
|
|
2482
|
-
var hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
|
|
2483
|
-
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
2484
|
-
function bytesToHex(bytes) {
|
|
2485
|
-
abytes(bytes);
|
|
2486
|
-
if (hasHexBuiltin)
|
|
2487
|
-
return bytes.toHex();
|
|
2488
|
-
let hex = "";
|
|
2489
|
-
for (let i = 0;i < bytes.length; i++) {
|
|
2490
|
-
hex += hexes[bytes[i]];
|
|
2491
|
-
}
|
|
2492
|
-
return hex;
|
|
2493
|
-
}
|
|
2494
|
-
function utf8ToBytes(str) {
|
|
2495
|
-
if (typeof str !== "string")
|
|
2496
|
-
throw new Error("string expected");
|
|
2497
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
|
2498
|
-
}
|
|
2499
|
-
function toBytes(data) {
|
|
2500
|
-
if (typeof data === "string")
|
|
2501
|
-
data = utf8ToBytes(data);
|
|
2502
|
-
abytes(data);
|
|
2503
|
-
return data;
|
|
2504
|
-
}
|
|
2505
|
-
class Hash {
|
|
2506
|
-
}
|
|
2507
|
-
function createHasher(hashCons) {
|
|
2508
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
2509
|
-
const tmp = hashCons();
|
|
2510
|
-
hashC.outputLen = tmp.outputLen;
|
|
2511
|
-
hashC.blockLen = tmp.blockLen;
|
|
2512
|
-
hashC.create = () => hashCons();
|
|
2513
|
-
return hashC;
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
// ../../node_modules/@noble/hashes/esm/_md.js
|
|
2517
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
2518
|
-
if (typeof view.setBigUint64 === "function")
|
|
2519
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
|
2520
|
-
const _32n = BigInt(32);
|
|
2521
|
-
const _u32_max = BigInt(4294967295);
|
|
2522
|
-
const wh = Number(value >> _32n & _u32_max);
|
|
2523
|
-
const wl = Number(value & _u32_max);
|
|
2524
|
-
const h = isLE ? 4 : 0;
|
|
2525
|
-
const l = isLE ? 0 : 4;
|
|
2526
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
2527
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
2528
|
-
}
|
|
2529
|
-
function Chi(a, b, c) {
|
|
2530
|
-
return a & b ^ ~a & c;
|
|
2531
|
-
}
|
|
2532
|
-
function Maj(a, b, c) {
|
|
2533
|
-
return a & b ^ a & c ^ b & c;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
class HashMD extends Hash {
|
|
2537
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
2538
|
-
super();
|
|
2539
|
-
this.finished = false;
|
|
2540
|
-
this.length = 0;
|
|
2541
|
-
this.pos = 0;
|
|
2542
|
-
this.destroyed = false;
|
|
2543
|
-
this.blockLen = blockLen;
|
|
2544
|
-
this.outputLen = outputLen;
|
|
2545
|
-
this.padOffset = padOffset;
|
|
2546
|
-
this.isLE = isLE;
|
|
2547
|
-
this.buffer = new Uint8Array(blockLen);
|
|
2548
|
-
this.view = createView(this.buffer);
|
|
2549
|
-
}
|
|
2550
|
-
update(data) {
|
|
2551
|
-
aexists(this);
|
|
2552
|
-
data = toBytes(data);
|
|
2553
|
-
abytes(data);
|
|
2554
|
-
const { view, buffer, blockLen } = this;
|
|
2555
|
-
const len = data.length;
|
|
2556
|
-
for (let pos = 0;pos < len; ) {
|
|
2557
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
2558
|
-
if (take === blockLen) {
|
|
2559
|
-
const dataView = createView(data);
|
|
2560
|
-
for (;blockLen <= len - pos; pos += blockLen)
|
|
2561
|
-
this.process(dataView, pos);
|
|
2562
|
-
continue;
|
|
2563
|
-
}
|
|
2564
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
2565
|
-
this.pos += take;
|
|
2566
|
-
pos += take;
|
|
2567
|
-
if (this.pos === blockLen) {
|
|
2568
|
-
this.process(view, 0);
|
|
2569
|
-
this.pos = 0;
|
|
2570
|
-
}
|
|
2571
|
-
}
|
|
2572
|
-
this.length += data.length;
|
|
2573
|
-
this.roundClean();
|
|
2574
|
-
return this;
|
|
2575
|
-
}
|
|
2576
|
-
digestInto(out) {
|
|
2577
|
-
aexists(this);
|
|
2578
|
-
aoutput(out, this);
|
|
2579
|
-
this.finished = true;
|
|
2580
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
2581
|
-
let { pos } = this;
|
|
2582
|
-
buffer[pos++] = 128;
|
|
2583
|
-
clean(this.buffer.subarray(pos));
|
|
2584
|
-
if (this.padOffset > blockLen - pos) {
|
|
2585
|
-
this.process(view, 0);
|
|
2586
|
-
pos = 0;
|
|
2587
|
-
}
|
|
2588
|
-
for (let i = pos;i < blockLen; i++)
|
|
2589
|
-
buffer[i] = 0;
|
|
2590
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
2591
|
-
this.process(view, 0);
|
|
2592
|
-
const oview = createView(out);
|
|
2593
|
-
const len = this.outputLen;
|
|
2594
|
-
if (len % 4)
|
|
2595
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
2596
|
-
const outLen = len / 4;
|
|
2597
|
-
const state = this.get();
|
|
2598
|
-
if (outLen > state.length)
|
|
2599
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
2600
|
-
for (let i = 0;i < outLen; i++)
|
|
2601
|
-
oview.setUint32(4 * i, state[i], isLE);
|
|
2602
|
-
}
|
|
2603
|
-
digest() {
|
|
2604
|
-
const { buffer, outputLen } = this;
|
|
2605
|
-
this.digestInto(buffer);
|
|
2606
|
-
const res = buffer.slice(0, outputLen);
|
|
2607
|
-
this.destroy();
|
|
2608
|
-
return res;
|
|
2609
|
-
}
|
|
2610
|
-
_cloneInto(to) {
|
|
2611
|
-
to || (to = new this.constructor);
|
|
2612
|
-
to.set(...this.get());
|
|
2613
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
2614
|
-
to.destroyed = destroyed;
|
|
2615
|
-
to.finished = finished;
|
|
2616
|
-
to.length = length;
|
|
2617
|
-
to.pos = pos;
|
|
2618
|
-
if (length % blockLen)
|
|
2619
|
-
to.buffer.set(buffer);
|
|
2620
|
-
return to;
|
|
2621
|
-
}
|
|
2622
|
-
clone() {
|
|
2623
|
-
return this._cloneInto();
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
2627
|
-
1779033703,
|
|
2628
|
-
3144134277,
|
|
2629
|
-
1013904242,
|
|
2630
|
-
2773480762,
|
|
2631
|
-
1359893119,
|
|
2632
|
-
2600822924,
|
|
2633
|
-
528734635,
|
|
2634
|
-
1541459225
|
|
2635
|
-
]);
|
|
2636
|
-
|
|
2637
|
-
// ../../node_modules/@noble/hashes/esm/sha2.js
|
|
2638
|
-
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
2639
|
-
1116352408,
|
|
2640
|
-
1899447441,
|
|
2641
|
-
3049323471,
|
|
2642
|
-
3921009573,
|
|
2643
|
-
961987163,
|
|
2644
|
-
1508970993,
|
|
2645
|
-
2453635748,
|
|
2646
|
-
2870763221,
|
|
2647
|
-
3624381080,
|
|
2648
|
-
310598401,
|
|
2649
|
-
607225278,
|
|
2650
|
-
1426881987,
|
|
2651
|
-
1925078388,
|
|
2652
|
-
2162078206,
|
|
2653
|
-
2614888103,
|
|
2654
|
-
3248222580,
|
|
2655
|
-
3835390401,
|
|
2656
|
-
4022224774,
|
|
2657
|
-
264347078,
|
|
2658
|
-
604807628,
|
|
2659
|
-
770255983,
|
|
2660
|
-
1249150122,
|
|
2661
|
-
1555081692,
|
|
2662
|
-
1996064986,
|
|
2663
|
-
2554220882,
|
|
2664
|
-
2821834349,
|
|
2665
|
-
2952996808,
|
|
2666
|
-
3210313671,
|
|
2667
|
-
3336571891,
|
|
2668
|
-
3584528711,
|
|
2669
|
-
113926993,
|
|
2670
|
-
338241895,
|
|
2671
|
-
666307205,
|
|
2672
|
-
773529912,
|
|
2673
|
-
1294757372,
|
|
2674
|
-
1396182291,
|
|
2675
|
-
1695183700,
|
|
2676
|
-
1986661051,
|
|
2677
|
-
2177026350,
|
|
2678
|
-
2456956037,
|
|
2679
|
-
2730485921,
|
|
2680
|
-
2820302411,
|
|
2681
|
-
3259730800,
|
|
2682
|
-
3345764771,
|
|
2683
|
-
3516065817,
|
|
2684
|
-
3600352804,
|
|
2685
|
-
4094571909,
|
|
2686
|
-
275423344,
|
|
2687
|
-
430227734,
|
|
2688
|
-
506948616,
|
|
2689
|
-
659060556,
|
|
2690
|
-
883997877,
|
|
2691
|
-
958139571,
|
|
2692
|
-
1322822218,
|
|
2693
|
-
1537002063,
|
|
2694
|
-
1747873779,
|
|
2695
|
-
1955562222,
|
|
2696
|
-
2024104815,
|
|
2697
|
-
2227730452,
|
|
2698
|
-
2361852424,
|
|
2699
|
-
2428436474,
|
|
2700
|
-
2756734187,
|
|
2701
|
-
3204031479,
|
|
2702
|
-
3329325298
|
|
2703
|
-
]);
|
|
2704
|
-
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
2705
|
-
|
|
2706
|
-
class SHA256 extends HashMD {
|
|
2707
|
-
constructor(outputLen = 32) {
|
|
2708
|
-
super(64, outputLen, 8, false);
|
|
2709
|
-
this.A = SHA256_IV[0] | 0;
|
|
2710
|
-
this.B = SHA256_IV[1] | 0;
|
|
2711
|
-
this.C = SHA256_IV[2] | 0;
|
|
2712
|
-
this.D = SHA256_IV[3] | 0;
|
|
2713
|
-
this.E = SHA256_IV[4] | 0;
|
|
2714
|
-
this.F = SHA256_IV[5] | 0;
|
|
2715
|
-
this.G = SHA256_IV[6] | 0;
|
|
2716
|
-
this.H = SHA256_IV[7] | 0;
|
|
2717
|
-
}
|
|
2718
|
-
get() {
|
|
2719
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
2720
|
-
return [A, B, C, D, E, F, G, H];
|
|
2721
|
-
}
|
|
2722
|
-
set(A, B, C, D, E, F, G, H) {
|
|
2723
|
-
this.A = A | 0;
|
|
2724
|
-
this.B = B | 0;
|
|
2725
|
-
this.C = C | 0;
|
|
2726
|
-
this.D = D | 0;
|
|
2727
|
-
this.E = E | 0;
|
|
2728
|
-
this.F = F | 0;
|
|
2729
|
-
this.G = G | 0;
|
|
2730
|
-
this.H = H | 0;
|
|
2731
|
-
}
|
|
2732
|
-
process(view, offset) {
|
|
2733
|
-
for (let i = 0;i < 16; i++, offset += 4)
|
|
2734
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
2735
|
-
for (let i = 16;i < 64; i++) {
|
|
2736
|
-
const W15 = SHA256_W[i - 15];
|
|
2737
|
-
const W2 = SHA256_W[i - 2];
|
|
2738
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
2739
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
2740
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
2741
|
-
}
|
|
2742
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
2743
|
-
for (let i = 0;i < 64; i++) {
|
|
2744
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
2745
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
2746
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
2747
|
-
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
2748
|
-
H = G;
|
|
2749
|
-
G = F;
|
|
2750
|
-
F = E;
|
|
2751
|
-
E = D + T1 | 0;
|
|
2752
|
-
D = C;
|
|
2753
|
-
C = B;
|
|
2754
|
-
B = A;
|
|
2755
|
-
A = T1 + T2 | 0;
|
|
117
|
+
const remaining = [];
|
|
118
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
119
|
+
const argument = args[index];
|
|
120
|
+
if (argument === "--json") {
|
|
121
|
+
global.json = true;
|
|
122
|
+
} else if (argument === "--help" || argument === "-h") {
|
|
123
|
+
global.help = true;
|
|
124
|
+
} else if (argument === "--version" || argument === "-v") {
|
|
125
|
+
global.version = true;
|
|
126
|
+
} else if (argument === "--profile" || argument.startsWith("--profile=")) {
|
|
127
|
+
const [value, consumedIndex] = optionValue(args, index, "--profile");
|
|
128
|
+
global.profile = value;
|
|
129
|
+
index = consumedIndex;
|
|
130
|
+
} else if (argument === "--api-url" || argument.startsWith("--api-url=")) {
|
|
131
|
+
const [value, consumedIndex] = optionValue(args, index, "--api-url");
|
|
132
|
+
global.apiUrl = value;
|
|
133
|
+
index = consumedIndex;
|
|
134
|
+
} else {
|
|
135
|
+
remaining.push(argument);
|
|
2756
136
|
}
|
|
2757
|
-
A = A + this.A | 0;
|
|
2758
|
-
B = B + this.B | 0;
|
|
2759
|
-
C = C + this.C | 0;
|
|
2760
|
-
D = D + this.D | 0;
|
|
2761
|
-
E = E + this.E | 0;
|
|
2762
|
-
F = F + this.F | 0;
|
|
2763
|
-
G = G + this.G | 0;
|
|
2764
|
-
H = H + this.H | 0;
|
|
2765
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
2766
137
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
var sha256MediaContent = async (source, options) => {
|
|
2780
|
-
const hasher = sha256.create();
|
|
2781
|
-
let bytesHashed = 0;
|
|
2782
|
-
const update = (chunk) => {
|
|
2783
|
-
if (options?.signal?.aborted) {
|
|
2784
|
-
throw new DOMException("Hashing aborted.", "AbortError");
|
|
2785
|
-
}
|
|
2786
|
-
hasher.update(chunk);
|
|
2787
|
-
bytesHashed += chunk.byteLength;
|
|
2788
|
-
options?.onProgress?.(bytesHashed);
|
|
2789
|
-
};
|
|
2790
|
-
if (isReadableStream(source)) {
|
|
2791
|
-
const reader = source.getReader();
|
|
2792
|
-
try {
|
|
2793
|
-
while (true) {
|
|
2794
|
-
const result = await reader.read();
|
|
2795
|
-
if (result.done)
|
|
2796
|
-
break;
|
|
2797
|
-
update(result.value);
|
|
2798
|
-
}
|
|
2799
|
-
} finally {
|
|
2800
|
-
reader.releaseLock();
|
|
2801
|
-
}
|
|
2802
|
-
} else {
|
|
2803
|
-
for await (const chunk of source)
|
|
2804
|
-
update(chunk);
|
|
138
|
+
return { args: remaining, global };
|
|
139
|
+
};
|
|
140
|
+
var parseCommandArgs = (args, config) => {
|
|
141
|
+
try {
|
|
142
|
+
return parseArgs({
|
|
143
|
+
allowPositionals: true,
|
|
144
|
+
args,
|
|
145
|
+
options: config.options,
|
|
146
|
+
strict: true
|
|
147
|
+
});
|
|
148
|
+
} catch (error) {
|
|
149
|
+
throw new CliError(toErrorMessage(error), 2);
|
|
2805
150
|
}
|
|
2806
|
-
return `sha256:${bytesToHex(hasher.digest())}`;
|
|
2807
151
|
};
|
|
2808
|
-
var
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
"image/jpg",
|
|
2815
|
-
"image/png",
|
|
2816
|
-
"image/webp"
|
|
2817
|
-
]);
|
|
2818
|
-
var DEFAULT_MEDIA_DELIVERY_HOSTS = {
|
|
2819
|
-
assets: "https://assets.highlight.xyz",
|
|
2820
|
-
metadata: "https://metadata.highlight.xyz",
|
|
2821
|
-
legacyAssets: "https://highlight-creator-assets.highlight.xyz",
|
|
2822
|
-
arweaveGateway: "https://arweave.net",
|
|
2823
|
-
ipfsGateway: "https://ipfs.io"
|
|
152
|
+
var requiredPositional = (positionals, index, label) => {
|
|
153
|
+
const value = positionals[index];
|
|
154
|
+
if (!value) {
|
|
155
|
+
throw new CliError(`Missing required argument: ${label}`, 2);
|
|
156
|
+
}
|
|
157
|
+
return value;
|
|
2824
158
|
};
|
|
2825
|
-
var
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
case "R2" /* R2 */: {
|
|
2829
|
-
if (LEGACY_REFERENCE.test(location.reference)) {
|
|
2830
|
-
return `${hosts.legacyAssets}/${location.reference}`;
|
|
2831
|
-
}
|
|
2832
|
-
if (media.parentId && media.path) {
|
|
2833
|
-
return `${hosts.assets}/${media.parentId}/${media.path}`;
|
|
2834
|
-
}
|
|
2835
|
-
return media.kind === "Directory" /* Directory */ ? `${hosts.assets}/${media.id}/` : `${hosts.assets}/${media.id}`;
|
|
2836
|
-
}
|
|
2837
|
-
case "Arweave" /* Arweave */:
|
|
2838
|
-
return `${hosts.arweaveGateway}/${location.reference}`;
|
|
2839
|
-
case "IPFS" /* Ipfs */:
|
|
2840
|
-
return `${hosts.ipfsGateway}/ipfs/${location.reference.replace(/^ipfs:\/\//, "").replace(/^\//, "")}`;
|
|
2841
|
-
case "External" /* External */:
|
|
2842
|
-
return location.reference;
|
|
2843
|
-
default:
|
|
2844
|
-
return null;
|
|
159
|
+
var assertNoExtraPositionals = (positionals, expected) => {
|
|
160
|
+
if (positionals.length > expected) {
|
|
161
|
+
throw new CliError(`Unexpected argument: ${positionals[expected]}`, 2);
|
|
2845
162
|
}
|
|
2846
163
|
};
|
|
2847
|
-
var
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
for (const role of preference) {
|
|
2854
|
-
const location = media.locations.find((l) => l.role === role && l.status === "Succeeded" /* Succeeded */);
|
|
2855
|
-
if (location)
|
|
2856
|
-
return location;
|
|
164
|
+
var positiveInteger = (value, label) => {
|
|
165
|
+
if (value === undefined)
|
|
166
|
+
return;
|
|
167
|
+
const parsed = Number(value);
|
|
168
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
169
|
+
throw new CliError(`${label} must be a positive integer`, 2);
|
|
2857
170
|
}
|
|
2858
|
-
return
|
|
171
|
+
return parsed;
|
|
2859
172
|
};
|
|
2860
|
-
var
|
|
2861
|
-
if (
|
|
2862
|
-
return
|
|
2863
|
-
const
|
|
2864
|
-
|
|
2865
|
-
|
|
173
|
+
var positiveNumber = (value, label) => {
|
|
174
|
+
if (value === undefined)
|
|
175
|
+
return;
|
|
176
|
+
const parsed = Number(value);
|
|
177
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
178
|
+
throw new CliError(`${label} must be a positive number`, 2);
|
|
179
|
+
}
|
|
180
|
+
return parsed;
|
|
2866
181
|
};
|
|
182
|
+
|
|
183
|
+
// src/commands/auth.ts
|
|
184
|
+
import { createHighlightClient as createHighlightClient2 } from "@highlightxyz/sdk";
|
|
185
|
+
|
|
2867
186
|
// src/config.ts
|
|
2868
187
|
import { chmod, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2869
188
|
import path from "node:path";
|
|
@@ -3009,15 +328,16 @@ var printDeployStatus = (runtime, status) => {
|
|
|
3009
328
|
runtime.stdout(JSON.stringify(status.contractConfig, null, 2));
|
|
3010
329
|
}
|
|
3011
330
|
};
|
|
3012
|
-
var printMedia = (runtime,
|
|
3013
|
-
runtime.stdout(`Media ${
|
|
3014
|
-
runtime.stdout(`File: ${
|
|
3015
|
-
runtime.stdout(`Kind: ${
|
|
331
|
+
var printMedia = (runtime, media, resolvedUrl) => {
|
|
332
|
+
runtime.stdout(`Media ${media.id}: ${media.status}`);
|
|
333
|
+
runtime.stdout(`File: ${media.fileName}`);
|
|
334
|
+
runtime.stdout(`Kind: ${media.kind}`);
|
|
3016
335
|
if (resolvedUrl)
|
|
3017
336
|
runtime.stdout(`URL: ${resolvedUrl}`);
|
|
3018
337
|
};
|
|
3019
338
|
|
|
3020
339
|
// src/sdk.ts
|
|
340
|
+
import { createHighlightClient } from "@highlightxyz/sdk";
|
|
3021
341
|
var createPublicClientContext = async (runtime, global) => {
|
|
3022
342
|
const config = await loadConfig(runtime);
|
|
3023
343
|
const profileName = profileNameFor(config, global.profile);
|
|
@@ -3025,7 +345,7 @@ var createPublicClientContext = async (runtime, global) => {
|
|
|
3025
345
|
const environmentKey = runtime.env.HIGHLIGHT_API_KEY;
|
|
3026
346
|
const apiKey = environmentKey ?? profile.apiKey;
|
|
3027
347
|
const apiUrl = global.apiUrl ?? runtime.env.HIGHLIGHT_API_URL ?? profile.apiUrl ?? DEFAULT_API_URL;
|
|
3028
|
-
const
|
|
348
|
+
const client = createHighlightClient({
|
|
3029
349
|
apiKey,
|
|
3030
350
|
baseUrl: apiUrl,
|
|
3031
351
|
fetch: runtime.fetch
|
|
@@ -3033,7 +353,7 @@ var createPublicClientContext = async (runtime, global) => {
|
|
|
3033
353
|
return {
|
|
3034
354
|
apiKey,
|
|
3035
355
|
apiUrl,
|
|
3036
|
-
client
|
|
356
|
+
client,
|
|
3037
357
|
config,
|
|
3038
358
|
credentialSource: apiKey ? environmentKey ? "environment" : "profile" : undefined,
|
|
3039
359
|
profileName
|
|
@@ -3091,12 +411,12 @@ var login = async (args, global, runtime) => {
|
|
|
3091
411
|
const profileName = profileNameFor(config, global.profile);
|
|
3092
412
|
const profile = profileFor(config, profileName);
|
|
3093
413
|
const apiUrl = validateApiUrl(global.apiUrl ?? runtime.env.HIGHLIGHT_API_URL ?? profile.apiUrl ?? DEFAULT_API_URL);
|
|
3094
|
-
const
|
|
414
|
+
const client = createHighlightClient2({
|
|
3095
415
|
apiKey,
|
|
3096
416
|
baseUrl: apiUrl,
|
|
3097
417
|
fetch: runtime.fetch
|
|
3098
418
|
});
|
|
3099
|
-
const keys = unwrap(await
|
|
419
|
+
const keys = unwrap(await client.apiKey.list());
|
|
3100
420
|
const activeKey = keys.find((key) => key.last4 === apiKey.slice(-4) && !key.revokedAt);
|
|
3101
421
|
await saveConfig(runtime, updateProfile(config, profileName, { apiKey, apiUrl }));
|
|
3102
422
|
const result = {
|
|
@@ -3242,6 +562,12 @@ var systemContract = async (args, global, runtime) => {
|
|
|
3242
562
|
runtime.stdout(`${result.type} on ${result.chainId}: ${result.address}`);
|
|
3243
563
|
};
|
|
3244
564
|
|
|
565
|
+
// src/commands/collections.ts
|
|
566
|
+
import {
|
|
567
|
+
CollectionType,
|
|
568
|
+
ContractStandard
|
|
569
|
+
} from "@highlightxyz/sdk";
|
|
570
|
+
|
|
3245
571
|
// src/json-input.ts
|
|
3246
572
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
3247
573
|
import path2 from "node:path";
|
|
@@ -3363,7 +689,7 @@ var create = async (args, global, runtime) => {
|
|
|
3363
689
|
});
|
|
3364
690
|
assertNoExtraPositionals(parsed.positionals, 0);
|
|
3365
691
|
const inputPath = requiredInputPath(parsed.values.input);
|
|
3366
|
-
const input = await readTypedJsonInput(inputPath, runtime, isCollectionCreateInput, "a collection.create object containing name,
|
|
692
|
+
const input = await readTypedJsonInput(inputPath, runtime, isCollectionCreateInput, "a collection.create object containing name, type, and valid contract details");
|
|
3367
693
|
const context = await createClientContext(runtime, global);
|
|
3368
694
|
const collection = unwrap(await context.client.collection.create(input));
|
|
3369
695
|
if (global.json) {
|
|
@@ -3484,6 +810,7 @@ var get2 = async (args, global, runtime) => {
|
|
|
3484
810
|
};
|
|
3485
811
|
|
|
3486
812
|
// src/commands/gates.ts
|
|
813
|
+
import { GateMatchMode } from "@highlightxyz/sdk";
|
|
3487
814
|
var isOptionalMatchMode = (value) => value === undefined || Object.values(GateMatchMode).includes(value);
|
|
3488
815
|
var isGateCondition = (value) => {
|
|
3489
816
|
if (!isRecord3(value) || !isRecord3(value.config))
|
|
@@ -3585,6 +912,11 @@ import { createReadStream } from "node:fs";
|
|
|
3585
912
|
import { stat } from "node:fs/promises";
|
|
3586
913
|
import path3 from "node:path";
|
|
3587
914
|
import { Readable } from "node:stream";
|
|
915
|
+
import {
|
|
916
|
+
MediaPurpose,
|
|
917
|
+
resolveMediaUrl,
|
|
918
|
+
sha256MediaContent
|
|
919
|
+
} from "@highlightxyz/sdk";
|
|
3588
920
|
var MIME_TYPES = {
|
|
3589
921
|
".css": "text/css",
|
|
3590
922
|
".gif": "image/gif",
|
|
@@ -3614,18 +946,18 @@ var parseResponseError = async (response) => {
|
|
|
3614
946
|
};
|
|
3615
947
|
var waitUntilReady = async (mediaId, initial, timeoutSeconds, pollIntervalSeconds, runtime, getMedia) => {
|
|
3616
948
|
const deadline = runtime.now() + timeoutSeconds * 1000;
|
|
3617
|
-
let
|
|
3618
|
-
while (
|
|
949
|
+
let media = initial;
|
|
950
|
+
while (media.status !== "Ready" && media.status !== "Failed") {
|
|
3619
951
|
if (runtime.now() >= deadline) {
|
|
3620
952
|
throw new CliError(`Timed out waiting for media ${mediaId} to become ready`);
|
|
3621
953
|
}
|
|
3622
954
|
await runtime.sleep(pollIntervalSeconds * 1000);
|
|
3623
|
-
|
|
955
|
+
media = await getMedia();
|
|
3624
956
|
}
|
|
3625
|
-
if (
|
|
957
|
+
if (media.status === "Failed") {
|
|
3626
958
|
throw new CliError(`Media processing failed for ${mediaId}`);
|
|
3627
959
|
}
|
|
3628
|
-
return
|
|
960
|
+
return media;
|
|
3629
961
|
};
|
|
3630
962
|
var upload = async (args, global, runtime) => {
|
|
3631
963
|
const parsed = parseCommandArgs(args, {
|
|
@@ -3651,7 +983,7 @@ var upload = async (args, global, runtime) => {
|
|
|
3651
983
|
throw new CliError(`--purpose must be one of: ${purposes.join(", ")}`, 2);
|
|
3652
984
|
}
|
|
3653
985
|
const collectionId = parsed.values.collection;
|
|
3654
|
-
const needsCollection = purpose !==
|
|
986
|
+
const needsCollection = purpose !== MediaPurpose.UserAvatar;
|
|
3655
987
|
if (needsCollection && !collectionId) {
|
|
3656
988
|
throw new CliError(`--collection is required for ${purpose} uploads`, 2);
|
|
3657
989
|
}
|
|
@@ -3681,47 +1013,51 @@ var upload = async (args, global, runtime) => {
|
|
|
3681
1013
|
if (!response.ok) {
|
|
3682
1014
|
throw new ApiError(await parseResponseError(response), response.status);
|
|
3683
1015
|
}
|
|
3684
|
-
let
|
|
1016
|
+
let media = unwrap(await context.client.media.finalizeUpload({
|
|
3685
1017
|
mediaId: session.uploadMediaId
|
|
3686
1018
|
}));
|
|
3687
1019
|
if (!parsed.values["no-wait"]) {
|
|
3688
|
-
|
|
1020
|
+
media = await waitUntilReady(media.id, media, positiveNumber(parsed.values.timeout, "--timeout") ?? 300, positiveNumber(parsed.values["poll-interval"], "--poll-interval") ?? 2, runtime, async () => unwrap(await context.client.media.get({ mediaId: media.id })));
|
|
3689
1021
|
}
|
|
3690
1022
|
const result = {
|
|
3691
|
-
media
|
|
3692
|
-
url: resolveMediaUrl(
|
|
1023
|
+
media,
|
|
1024
|
+
url: resolveMediaUrl(media)
|
|
3693
1025
|
};
|
|
3694
1026
|
if (global.json)
|
|
3695
1027
|
printJson(runtime, result);
|
|
3696
1028
|
else
|
|
3697
|
-
printMedia(runtime,
|
|
1029
|
+
printMedia(runtime, media, result.url);
|
|
3698
1030
|
};
|
|
3699
1031
|
var get4 = async (args, global, runtime) => {
|
|
3700
1032
|
const parsed = parseCommandArgs(args, { options: {} });
|
|
3701
1033
|
const mediaId = requiredPositional(parsed.positionals, 0, "media-id");
|
|
3702
1034
|
assertNoExtraPositionals(parsed.positionals, 1);
|
|
3703
1035
|
const context = await createClientContext(runtime, global);
|
|
3704
|
-
const
|
|
3705
|
-
const result = { media
|
|
1036
|
+
const media = unwrap(await context.client.media.get({ mediaId }));
|
|
1037
|
+
const result = { media, url: resolveMediaUrl(media) };
|
|
3706
1038
|
if (global.json)
|
|
3707
1039
|
printJson(runtime, result);
|
|
3708
1040
|
else
|
|
3709
|
-
printMedia(runtime,
|
|
1041
|
+
printMedia(runtime, media, result.url);
|
|
3710
1042
|
};
|
|
3711
1043
|
var publish = async (args, global, runtime) => {
|
|
3712
1044
|
const parsed = parseCommandArgs(args, { options: {} });
|
|
3713
1045
|
const mediaId = requiredPositional(parsed.positionals, 0, "media-id");
|
|
3714
1046
|
assertNoExtraPositionals(parsed.positionals, 1);
|
|
3715
1047
|
const context = await createClientContext(runtime, global);
|
|
3716
|
-
const
|
|
3717
|
-
const result = { media
|
|
1048
|
+
const media = unwrap(await context.client.media.publish({ mediaId }));
|
|
1049
|
+
const result = { media, url: resolveMediaUrl(media) };
|
|
3718
1050
|
if (global.json)
|
|
3719
1051
|
printJson(runtime, result);
|
|
3720
1052
|
else
|
|
3721
|
-
printMedia(runtime,
|
|
1053
|
+
printMedia(runtime, media, result.url);
|
|
3722
1054
|
};
|
|
3723
1055
|
|
|
3724
1056
|
// src/commands/sales.ts
|
|
1057
|
+
import {
|
|
1058
|
+
SaleAccessMode,
|
|
1059
|
+
SaleType
|
|
1060
|
+
} from "@highlightxyz/sdk";
|
|
3725
1061
|
var isOptionalNumber = (value) => value === undefined || typeof value === "number" && Number.isFinite(value);
|
|
3726
1062
|
var isOptionalBoolean = (value) => value === undefined || typeof value === "boolean";
|
|
3727
1063
|
var isSaleCreateInput = (value) => {
|
|
@@ -3833,6 +1169,7 @@ var remove2 = async (args, global, runtime) => {
|
|
|
3833
1169
|
};
|
|
3834
1170
|
|
|
3835
1171
|
// src/commands/tokens.ts
|
|
1172
|
+
import { resolveMediaUrl as resolveMediaUrl2 } from "@highlightxyz/sdk";
|
|
3836
1173
|
var list6 = async (args, global, runtime) => {
|
|
3837
1174
|
const parsed = parseCommandArgs(args, {
|
|
3838
1175
|
options: {
|
|
@@ -3884,7 +1221,7 @@ var list6 = async (args, global, runtime) => {
|
|
|
3884
1221
|
token.name,
|
|
3885
1222
|
token.status,
|
|
3886
1223
|
token.mintedAt,
|
|
3887
|
-
|
|
1224
|
+
resolveMediaUrl2(token.imageMedia)
|
|
3888
1225
|
]));
|
|
3889
1226
|
runtime.stdout(`Page ${result.pageInfo.page}/${Math.max(result.pageInfo.totalPages, 1)} · ${result.pageInfo.totalCount} total`);
|
|
3890
1227
|
};
|
|
@@ -3901,8 +1238,8 @@ var get5 = async (args, global, runtime) => {
|
|
|
3901
1238
|
}
|
|
3902
1239
|
runtime.stdout(`${token.name ?? `Token ${token.tokenId}`} (${token.tokenId})`);
|
|
3903
1240
|
runtime.stdout(`Status: ${token.status}`);
|
|
3904
|
-
runtime.stdout(`Image: ${
|
|
3905
|
-
runtime.stdout(`Animation: ${
|
|
1241
|
+
runtime.stdout(`Image: ${resolveMediaUrl2(token.imageMedia) ?? "unavailable"}`);
|
|
1242
|
+
runtime.stdout(`Animation: ${resolveMediaUrl2(token.animationMedia) ?? "unavailable"}`);
|
|
3906
1243
|
if (token.description)
|
|
3907
1244
|
runtime.stdout(`Description: ${token.description}`);
|
|
3908
1245
|
};
|