@multisender.app/multisender-sdk 0.0.1 → 0.0.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.
@@ -0,0 +1,1146 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __toCommonJS = (from) => {
33
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
34
+ if (entry)
35
+ return entry;
36
+ entry = __defProp({}, "__esModule", { value: true });
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (var key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(entry, key))
40
+ __defProp(entry, key, {
41
+ get: __accessProp.bind(from, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
45
+ __moduleCache.set(from, entry);
46
+ return entry;
47
+ };
48
+ var __moduleCache;
49
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
50
+ var __returnValue = (v) => v;
51
+ function __exportSetter(name, newValue) {
52
+ this[name] = __returnValue.bind(null, newValue);
53
+ }
54
+ var __export = (target, all) => {
55
+ for (var name in all)
56
+ __defProp(target, name, {
57
+ get: all[name],
58
+ enumerable: true,
59
+ configurable: true,
60
+ set: __exportSetter.bind(all, name)
61
+ });
62
+ };
63
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
64
+
65
+ // src/generated.ts
66
+ var exports_generated = {};
67
+ __export(exports_generated, {
68
+ validateDistributionRecipients: () => validateDistributionRecipients,
69
+ updateRecipients: () => updateRecipients,
70
+ updateApiKey: () => updateApiKey,
71
+ update2: () => update2,
72
+ update: () => update,
73
+ searchTokens: () => searchTokens,
74
+ removeRecipient: () => removeRecipient,
75
+ remove: () => remove,
76
+ prepareTransactions: () => prepareTransactions,
77
+ importFromFile: () => importFromFile,
78
+ importCsvDistribution: () => importCsvDistribution,
79
+ getTransactions: () => getTransactions,
80
+ getTokens: () => getTokens,
81
+ getToken: () => getToken,
82
+ getStats: () => getStats,
83
+ getRecipients: () => getRecipients,
84
+ getProjectMembers: () => getProjectMembers,
85
+ getProjectInfo: () => getProjectInfo,
86
+ getChains: () => getChains,
87
+ getChain: () => getChain,
88
+ getApproveCalldataForDistribution: () => getApproveCalldataForDistribution,
89
+ getApproveCalldata: () => getApproveCalldata,
90
+ getApiKeys: () => getApiKeys,
91
+ findOne2: () => findOne2,
92
+ findOne: () => findOne,
93
+ findAll2: () => findAll2,
94
+ findAll: () => findAll,
95
+ distribute: () => distribute,
96
+ deleteApiKey: () => deleteApiKey,
97
+ createDistributionList: () => createDistributionList,
98
+ createApiKey: () => createApiKey,
99
+ create2: () => create2,
100
+ create: () => create,
101
+ cancel: () => cancel,
102
+ addRecipientsBulk: () => addRecipientsBulk,
103
+ addRecipient: () => addRecipient
104
+ });
105
+ module.exports = __toCommonJS(exports_generated);
106
+
107
+ // src/gen/core/bodySerializer.gen.ts
108
+ var serializeFormDataPair = (data, key, value) => {
109
+ if (typeof value === "string" || value instanceof Blob) {
110
+ data.append(key, value);
111
+ } else if (value instanceof Date) {
112
+ data.append(key, value.toISOString());
113
+ } else {
114
+ data.append(key, JSON.stringify(value));
115
+ }
116
+ };
117
+ var formDataBodySerializer = {
118
+ bodySerializer: (body) => {
119
+ const data = new FormData;
120
+ Object.entries(body).forEach(([key, value]) => {
121
+ if (value === undefined || value === null) {
122
+ return;
123
+ }
124
+ if (Array.isArray(value)) {
125
+ value.forEach((v) => serializeFormDataPair(data, key, v));
126
+ } else {
127
+ serializeFormDataPair(data, key, value);
128
+ }
129
+ });
130
+ return data;
131
+ }
132
+ };
133
+ var jsonBodySerializer = {
134
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
135
+ };
136
+ // src/gen/core/params.gen.ts
137
+ var extraPrefixesMap = {
138
+ $body_: "body",
139
+ $headers_: "headers",
140
+ $path_: "path",
141
+ $query_: "query"
142
+ };
143
+ var extraPrefixes = Object.entries(extraPrefixesMap);
144
+ // src/gen/core/serverSentEvents.gen.ts
145
+ var createSseClient = ({
146
+ onRequest,
147
+ onSseError,
148
+ onSseEvent,
149
+ responseTransformer,
150
+ responseValidator,
151
+ sseDefaultRetryDelay,
152
+ sseMaxRetryAttempts,
153
+ sseMaxRetryDelay,
154
+ sseSleepFn,
155
+ url,
156
+ ...options
157
+ }) => {
158
+ let lastEventId;
159
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
160
+ const createStream = async function* () {
161
+ let retryDelay = sseDefaultRetryDelay ?? 3000;
162
+ let attempt = 0;
163
+ const signal = options.signal ?? new AbortController().signal;
164
+ while (true) {
165
+ if (signal.aborted)
166
+ break;
167
+ attempt++;
168
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
169
+ if (lastEventId !== undefined) {
170
+ headers.set("Last-Event-ID", lastEventId);
171
+ }
172
+ try {
173
+ const requestInit = {
174
+ redirect: "follow",
175
+ ...options,
176
+ body: options.serializedBody,
177
+ headers,
178
+ signal
179
+ };
180
+ let request = new Request(url, requestInit);
181
+ if (onRequest) {
182
+ request = await onRequest(url, requestInit);
183
+ }
184
+ const _fetch = options.fetch ?? globalThis.fetch;
185
+ const response = await _fetch(request);
186
+ if (!response.ok)
187
+ throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
188
+ if (!response.body)
189
+ throw new Error("No body in SSE response");
190
+ const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
191
+ let buffer = "";
192
+ const abortHandler = () => {
193
+ try {
194
+ reader.cancel();
195
+ } catch {}
196
+ };
197
+ signal.addEventListener("abort", abortHandler);
198
+ try {
199
+ while (true) {
200
+ const { done, value } = await reader.read();
201
+ if (done)
202
+ break;
203
+ buffer += value;
204
+ buffer = buffer.replace(/\r\n/g, `
205
+ `).replace(/\r/g, `
206
+ `);
207
+ const chunks = buffer.split(`
208
+
209
+ `);
210
+ buffer = chunks.pop() ?? "";
211
+ for (const chunk of chunks) {
212
+ const lines = chunk.split(`
213
+ `);
214
+ const dataLines = [];
215
+ let eventName;
216
+ for (const line of lines) {
217
+ if (line.startsWith("data:")) {
218
+ dataLines.push(line.replace(/^data:\s*/, ""));
219
+ } else if (line.startsWith("event:")) {
220
+ eventName = line.replace(/^event:\s*/, "");
221
+ } else if (line.startsWith("id:")) {
222
+ lastEventId = line.replace(/^id:\s*/, "");
223
+ } else if (line.startsWith("retry:")) {
224
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
225
+ if (!Number.isNaN(parsed)) {
226
+ retryDelay = parsed;
227
+ }
228
+ }
229
+ }
230
+ let data;
231
+ let parsedJson = false;
232
+ if (dataLines.length) {
233
+ const rawData = dataLines.join(`
234
+ `);
235
+ try {
236
+ data = JSON.parse(rawData);
237
+ parsedJson = true;
238
+ } catch {
239
+ data = rawData;
240
+ }
241
+ }
242
+ if (parsedJson) {
243
+ if (responseValidator) {
244
+ await responseValidator(data);
245
+ }
246
+ if (responseTransformer) {
247
+ data = await responseTransformer(data);
248
+ }
249
+ }
250
+ onSseEvent?.({
251
+ data,
252
+ event: eventName,
253
+ id: lastEventId,
254
+ retry: retryDelay
255
+ });
256
+ if (dataLines.length) {
257
+ yield data;
258
+ }
259
+ }
260
+ }
261
+ } finally {
262
+ signal.removeEventListener("abort", abortHandler);
263
+ reader.releaseLock();
264
+ }
265
+ break;
266
+ } catch (error) {
267
+ onSseError?.(error);
268
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
269
+ break;
270
+ }
271
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
272
+ await sleep(backoff);
273
+ }
274
+ }
275
+ };
276
+ const stream = createStream();
277
+ return { stream };
278
+ };
279
+
280
+ // src/gen/core/pathSerializer.gen.ts
281
+ var separatorArrayExplode = (style) => {
282
+ switch (style) {
283
+ case "label":
284
+ return ".";
285
+ case "matrix":
286
+ return ";";
287
+ case "simple":
288
+ return ",";
289
+ default:
290
+ return "&";
291
+ }
292
+ };
293
+ var separatorArrayNoExplode = (style) => {
294
+ switch (style) {
295
+ case "form":
296
+ return ",";
297
+ case "pipeDelimited":
298
+ return "|";
299
+ case "spaceDelimited":
300
+ return "%20";
301
+ default:
302
+ return ",";
303
+ }
304
+ };
305
+ var separatorObjectExplode = (style) => {
306
+ switch (style) {
307
+ case "label":
308
+ return ".";
309
+ case "matrix":
310
+ return ";";
311
+ case "simple":
312
+ return ",";
313
+ default:
314
+ return "&";
315
+ }
316
+ };
317
+ var serializeArrayParam = ({
318
+ allowReserved,
319
+ explode,
320
+ name,
321
+ style,
322
+ value
323
+ }) => {
324
+ if (!explode) {
325
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
326
+ switch (style) {
327
+ case "label":
328
+ return `.${joinedValues2}`;
329
+ case "matrix":
330
+ return `;${name}=${joinedValues2}`;
331
+ case "simple":
332
+ return joinedValues2;
333
+ default:
334
+ return `${name}=${joinedValues2}`;
335
+ }
336
+ }
337
+ const separator = separatorArrayExplode(style);
338
+ const joinedValues = value.map((v) => {
339
+ if (style === "label" || style === "simple") {
340
+ return allowReserved ? v : encodeURIComponent(v);
341
+ }
342
+ return serializePrimitiveParam({
343
+ allowReserved,
344
+ name,
345
+ value: v
346
+ });
347
+ }).join(separator);
348
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
349
+ };
350
+ var serializePrimitiveParam = ({
351
+ allowReserved,
352
+ name,
353
+ value
354
+ }) => {
355
+ if (value === undefined || value === null) {
356
+ return "";
357
+ }
358
+ if (typeof value === "object") {
359
+ throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
360
+ }
361
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
362
+ };
363
+ var serializeObjectParam = ({
364
+ allowReserved,
365
+ explode,
366
+ name,
367
+ style,
368
+ value,
369
+ valueOnly
370
+ }) => {
371
+ if (value instanceof Date) {
372
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
373
+ }
374
+ if (style !== "deepObject" && !explode) {
375
+ let values = [];
376
+ Object.entries(value).forEach(([key, v]) => {
377
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
378
+ });
379
+ const joinedValues2 = values.join(",");
380
+ switch (style) {
381
+ case "form":
382
+ return `${name}=${joinedValues2}`;
383
+ case "label":
384
+ return `.${joinedValues2}`;
385
+ case "matrix":
386
+ return `;${name}=${joinedValues2}`;
387
+ default:
388
+ return joinedValues2;
389
+ }
390
+ }
391
+ const separator = separatorObjectExplode(style);
392
+ const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
393
+ allowReserved,
394
+ name: style === "deepObject" ? `${name}[${key}]` : key,
395
+ value: v
396
+ })).join(separator);
397
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
398
+ };
399
+
400
+ // src/gen/core/utils.gen.ts
401
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
402
+ var defaultPathSerializer = ({ path, url: _url }) => {
403
+ let url = _url;
404
+ const matches = _url.match(PATH_PARAM_RE);
405
+ if (matches) {
406
+ for (const match of matches) {
407
+ let explode = false;
408
+ let name = match.substring(1, match.length - 1);
409
+ let style = "simple";
410
+ if (name.endsWith("*")) {
411
+ explode = true;
412
+ name = name.substring(0, name.length - 1);
413
+ }
414
+ if (name.startsWith(".")) {
415
+ name = name.substring(1);
416
+ style = "label";
417
+ } else if (name.startsWith(";")) {
418
+ name = name.substring(1);
419
+ style = "matrix";
420
+ }
421
+ const value = path[name];
422
+ if (value === undefined || value === null) {
423
+ continue;
424
+ }
425
+ if (Array.isArray(value)) {
426
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
427
+ continue;
428
+ }
429
+ if (typeof value === "object") {
430
+ url = url.replace(match, serializeObjectParam({
431
+ explode,
432
+ name,
433
+ style,
434
+ value,
435
+ valueOnly: true
436
+ }));
437
+ continue;
438
+ }
439
+ if (style === "matrix") {
440
+ url = url.replace(match, `;${serializePrimitiveParam({
441
+ name,
442
+ value
443
+ })}`);
444
+ continue;
445
+ }
446
+ const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
447
+ url = url.replace(match, replaceValue);
448
+ }
449
+ }
450
+ return url;
451
+ };
452
+ var getUrl = ({
453
+ baseUrl,
454
+ path,
455
+ query,
456
+ querySerializer,
457
+ url: _url
458
+ }) => {
459
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
460
+ let url = (baseUrl ?? "") + pathUrl;
461
+ if (path) {
462
+ url = defaultPathSerializer({ path, url });
463
+ }
464
+ let search = query ? querySerializer(query) : "";
465
+ if (search.startsWith("?")) {
466
+ search = search.substring(1);
467
+ }
468
+ if (search) {
469
+ url += `?${search}`;
470
+ }
471
+ return url;
472
+ };
473
+ function getValidRequestBody(options) {
474
+ const hasBody = options.body !== undefined;
475
+ const isSerializedBody = hasBody && options.bodySerializer;
476
+ if (isSerializedBody) {
477
+ if ("serializedBody" in options) {
478
+ const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
479
+ return hasSerializedBody ? options.serializedBody : null;
480
+ }
481
+ return options.body !== "" ? options.body : null;
482
+ }
483
+ if (hasBody) {
484
+ return options.body;
485
+ }
486
+ return;
487
+ }
488
+
489
+ // src/gen/core/auth.gen.ts
490
+ var getAuthToken = async (auth, callback) => {
491
+ const token = typeof callback === "function" ? await callback(auth) : callback;
492
+ if (!token) {
493
+ return;
494
+ }
495
+ if (auth.scheme === "bearer") {
496
+ return `Bearer ${token}`;
497
+ }
498
+ if (auth.scheme === "basic") {
499
+ return `Basic ${btoa(token)}`;
500
+ }
501
+ return token;
502
+ };
503
+
504
+ // src/gen/client/utils.gen.ts
505
+ var createQuerySerializer = ({
506
+ parameters = {},
507
+ ...args
508
+ } = {}) => {
509
+ const querySerializer = (queryParams) => {
510
+ const search = [];
511
+ if (queryParams && typeof queryParams === "object") {
512
+ for (const name in queryParams) {
513
+ const value = queryParams[name];
514
+ if (value === undefined || value === null) {
515
+ continue;
516
+ }
517
+ const options = parameters[name] || args;
518
+ if (Array.isArray(value)) {
519
+ const serializedArray = serializeArrayParam({
520
+ allowReserved: options.allowReserved,
521
+ explode: true,
522
+ name,
523
+ style: "form",
524
+ value,
525
+ ...options.array
526
+ });
527
+ if (serializedArray)
528
+ search.push(serializedArray);
529
+ } else if (typeof value === "object") {
530
+ const serializedObject = serializeObjectParam({
531
+ allowReserved: options.allowReserved,
532
+ explode: true,
533
+ name,
534
+ style: "deepObject",
535
+ value,
536
+ ...options.object
537
+ });
538
+ if (serializedObject)
539
+ search.push(serializedObject);
540
+ } else {
541
+ const serializedPrimitive = serializePrimitiveParam({
542
+ allowReserved: options.allowReserved,
543
+ name,
544
+ value
545
+ });
546
+ if (serializedPrimitive)
547
+ search.push(serializedPrimitive);
548
+ }
549
+ }
550
+ }
551
+ return search.join("&");
552
+ };
553
+ return querySerializer;
554
+ };
555
+ var getParseAs = (contentType) => {
556
+ if (!contentType) {
557
+ return "stream";
558
+ }
559
+ const cleanContent = contentType.split(";")[0]?.trim();
560
+ if (!cleanContent) {
561
+ return;
562
+ }
563
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
564
+ return "json";
565
+ }
566
+ if (cleanContent === "multipart/form-data") {
567
+ return "formData";
568
+ }
569
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
570
+ return "blob";
571
+ }
572
+ if (cleanContent.startsWith("text/")) {
573
+ return "text";
574
+ }
575
+ return;
576
+ };
577
+ var checkForExistence = (options, name) => {
578
+ if (!name) {
579
+ return false;
580
+ }
581
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
582
+ return true;
583
+ }
584
+ return false;
585
+ };
586
+ var setAuthParams = async ({
587
+ security,
588
+ ...options
589
+ }) => {
590
+ for (const auth of security) {
591
+ if (checkForExistence(options, auth.name)) {
592
+ continue;
593
+ }
594
+ const token = await getAuthToken(auth, options.auth);
595
+ if (!token) {
596
+ continue;
597
+ }
598
+ const name = auth.name ?? "Authorization";
599
+ switch (auth.in) {
600
+ case "query":
601
+ if (!options.query) {
602
+ options.query = {};
603
+ }
604
+ options.query[name] = token;
605
+ break;
606
+ case "cookie":
607
+ options.headers.append("Cookie", `${name}=${token}`);
608
+ break;
609
+ case "header":
610
+ default:
611
+ options.headers.set(name, token);
612
+ break;
613
+ }
614
+ }
615
+ };
616
+ var buildUrl = (options) => getUrl({
617
+ baseUrl: options.baseUrl,
618
+ path: options.path,
619
+ query: options.query,
620
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
621
+ url: options.url
622
+ });
623
+ var mergeConfigs = (a, b) => {
624
+ const config = { ...a, ...b };
625
+ if (config.baseUrl?.endsWith("/")) {
626
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
627
+ }
628
+ config.headers = mergeHeaders(a.headers, b.headers);
629
+ return config;
630
+ };
631
+ var headersEntries = (headers) => {
632
+ const entries = [];
633
+ headers.forEach((value, key) => {
634
+ entries.push([key, value]);
635
+ });
636
+ return entries;
637
+ };
638
+ var mergeHeaders = (...headers) => {
639
+ const mergedHeaders = new Headers;
640
+ for (const header of headers) {
641
+ if (!header) {
642
+ continue;
643
+ }
644
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
645
+ for (const [key, value] of iterator) {
646
+ if (value === null) {
647
+ mergedHeaders.delete(key);
648
+ } else if (Array.isArray(value)) {
649
+ for (const v of value) {
650
+ mergedHeaders.append(key, v);
651
+ }
652
+ } else if (value !== undefined) {
653
+ mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
654
+ }
655
+ }
656
+ }
657
+ return mergedHeaders;
658
+ };
659
+
660
+ class Interceptors {
661
+ fns = [];
662
+ clear() {
663
+ this.fns = [];
664
+ }
665
+ eject(id) {
666
+ const index = this.getInterceptorIndex(id);
667
+ if (this.fns[index]) {
668
+ this.fns[index] = null;
669
+ }
670
+ }
671
+ exists(id) {
672
+ const index = this.getInterceptorIndex(id);
673
+ return Boolean(this.fns[index]);
674
+ }
675
+ getInterceptorIndex(id) {
676
+ if (typeof id === "number") {
677
+ return this.fns[id] ? id : -1;
678
+ }
679
+ return this.fns.indexOf(id);
680
+ }
681
+ update(id, fn) {
682
+ const index = this.getInterceptorIndex(id);
683
+ if (this.fns[index]) {
684
+ this.fns[index] = fn;
685
+ return id;
686
+ }
687
+ return false;
688
+ }
689
+ use(fn) {
690
+ this.fns.push(fn);
691
+ return this.fns.length - 1;
692
+ }
693
+ }
694
+ var createInterceptors = () => ({
695
+ error: new Interceptors,
696
+ request: new Interceptors,
697
+ response: new Interceptors
698
+ });
699
+ var defaultQuerySerializer = createQuerySerializer({
700
+ allowReserved: false,
701
+ array: {
702
+ explode: true,
703
+ style: "form"
704
+ },
705
+ object: {
706
+ explode: true,
707
+ style: "deepObject"
708
+ }
709
+ });
710
+ var defaultHeaders = {
711
+ "Content-Type": "application/json"
712
+ };
713
+ var createConfig = (override = {}) => ({
714
+ ...jsonBodySerializer,
715
+ headers: defaultHeaders,
716
+ parseAs: "auto",
717
+ querySerializer: defaultQuerySerializer,
718
+ ...override
719
+ });
720
+
721
+ // src/gen/client/client.gen.ts
722
+ var createClient = (config = {}) => {
723
+ let _config = mergeConfigs(createConfig(), config);
724
+ const getConfig = () => ({ ..._config });
725
+ const setConfig = (config2) => {
726
+ _config = mergeConfigs(_config, config2);
727
+ return getConfig();
728
+ };
729
+ const interceptors = createInterceptors();
730
+ const beforeRequest = async (options) => {
731
+ const opts = {
732
+ ..._config,
733
+ ...options,
734
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
735
+ headers: mergeHeaders(_config.headers, options.headers),
736
+ serializedBody: undefined
737
+ };
738
+ if (opts.security) {
739
+ await setAuthParams({
740
+ ...opts,
741
+ security: opts.security
742
+ });
743
+ }
744
+ if (opts.requestValidator) {
745
+ await opts.requestValidator(opts);
746
+ }
747
+ if (opts.body !== undefined && opts.bodySerializer) {
748
+ opts.serializedBody = opts.bodySerializer(opts.body);
749
+ }
750
+ if (opts.body === undefined || opts.serializedBody === "") {
751
+ opts.headers.delete("Content-Type");
752
+ }
753
+ const url = buildUrl(opts);
754
+ return { opts, url };
755
+ };
756
+ const request = async (options) => {
757
+ const { opts, url } = await beforeRequest(options);
758
+ const requestInit = {
759
+ redirect: "follow",
760
+ ...opts,
761
+ body: getValidRequestBody(opts)
762
+ };
763
+ let request2 = new Request(url, requestInit);
764
+ for (const fn of interceptors.request.fns) {
765
+ if (fn) {
766
+ request2 = await fn(request2, opts);
767
+ }
768
+ }
769
+ const _fetch = opts.fetch;
770
+ let response;
771
+ try {
772
+ response = await _fetch(request2);
773
+ } catch (error2) {
774
+ let finalError2 = error2;
775
+ for (const fn of interceptors.error.fns) {
776
+ if (fn) {
777
+ finalError2 = await fn(error2, undefined, request2, opts);
778
+ }
779
+ }
780
+ finalError2 = finalError2 || {};
781
+ if (opts.throwOnError) {
782
+ throw finalError2;
783
+ }
784
+ return opts.responseStyle === "data" ? undefined : {
785
+ error: finalError2,
786
+ request: request2,
787
+ response: undefined
788
+ };
789
+ }
790
+ for (const fn of interceptors.response.fns) {
791
+ if (fn) {
792
+ response = await fn(response, request2, opts);
793
+ }
794
+ }
795
+ const result = {
796
+ request: request2,
797
+ response
798
+ };
799
+ if (response.ok) {
800
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
801
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
802
+ let emptyData;
803
+ switch (parseAs) {
804
+ case "arrayBuffer":
805
+ case "blob":
806
+ case "text":
807
+ emptyData = await response[parseAs]();
808
+ break;
809
+ case "formData":
810
+ emptyData = new FormData;
811
+ break;
812
+ case "stream":
813
+ emptyData = response.body;
814
+ break;
815
+ case "json":
816
+ default:
817
+ emptyData = {};
818
+ break;
819
+ }
820
+ return opts.responseStyle === "data" ? emptyData : {
821
+ data: emptyData,
822
+ ...result
823
+ };
824
+ }
825
+ let data;
826
+ switch (parseAs) {
827
+ case "arrayBuffer":
828
+ case "blob":
829
+ case "formData":
830
+ case "text":
831
+ data = await response[parseAs]();
832
+ break;
833
+ case "json": {
834
+ const text = await response.text();
835
+ data = text ? JSON.parse(text) : {};
836
+ break;
837
+ }
838
+ case "stream":
839
+ return opts.responseStyle === "data" ? response.body : {
840
+ data: response.body,
841
+ ...result
842
+ };
843
+ }
844
+ if (parseAs === "json") {
845
+ if (opts.responseValidator) {
846
+ await opts.responseValidator(data);
847
+ }
848
+ if (opts.responseTransformer) {
849
+ data = await opts.responseTransformer(data);
850
+ }
851
+ }
852
+ return opts.responseStyle === "data" ? data : {
853
+ data,
854
+ ...result
855
+ };
856
+ }
857
+ const textError = await response.text();
858
+ let jsonError;
859
+ try {
860
+ jsonError = JSON.parse(textError);
861
+ } catch {}
862
+ const error = jsonError ?? textError;
863
+ let finalError = error;
864
+ for (const fn of interceptors.error.fns) {
865
+ if (fn) {
866
+ finalError = await fn(error, response, request2, opts);
867
+ }
868
+ }
869
+ finalError = finalError || {};
870
+ if (opts.throwOnError) {
871
+ throw finalError;
872
+ }
873
+ return opts.responseStyle === "data" ? undefined : {
874
+ error: finalError,
875
+ ...result
876
+ };
877
+ };
878
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
879
+ const makeSseFn = (method) => async (options) => {
880
+ const { opts, url } = await beforeRequest(options);
881
+ return createSseClient({
882
+ ...opts,
883
+ body: opts.body,
884
+ headers: opts.headers,
885
+ method,
886
+ onRequest: async (url2, init) => {
887
+ let request2 = new Request(url2, init);
888
+ for (const fn of interceptors.request.fns) {
889
+ if (fn) {
890
+ request2 = await fn(request2, opts);
891
+ }
892
+ }
893
+ return request2;
894
+ },
895
+ serializedBody: getValidRequestBody(opts),
896
+ url
897
+ });
898
+ };
899
+ return {
900
+ buildUrl,
901
+ connect: makeMethodFn("CONNECT"),
902
+ delete: makeMethodFn("DELETE"),
903
+ get: makeMethodFn("GET"),
904
+ getConfig,
905
+ head: makeMethodFn("HEAD"),
906
+ interceptors,
907
+ options: makeMethodFn("OPTIONS"),
908
+ patch: makeMethodFn("PATCH"),
909
+ post: makeMethodFn("POST"),
910
+ put: makeMethodFn("PUT"),
911
+ request,
912
+ setConfig,
913
+ sse: {
914
+ connect: makeSseFn("CONNECT"),
915
+ delete: makeSseFn("DELETE"),
916
+ get: makeSseFn("GET"),
917
+ head: makeSseFn("HEAD"),
918
+ options: makeSseFn("OPTIONS"),
919
+ patch: makeSseFn("PATCH"),
920
+ post: makeSseFn("POST"),
921
+ put: makeSseFn("PUT"),
922
+ trace: makeSseFn("TRACE")
923
+ },
924
+ trace: makeMethodFn("TRACE")
925
+ };
926
+ };
927
+ // src/openapi-runtime.ts
928
+ var DEFAULT_BASE_URL = "https://api.multisender.app";
929
+ var DEFAULT_TIMEOUT = 30000;
930
+ var defaultRuntimeConfig = {
931
+ apiKey: "",
932
+ baseUrl: DEFAULT_BASE_URL,
933
+ timeout: DEFAULT_TIMEOUT,
934
+ headers: {}
935
+ };
936
+ var mergeHeaders2 = (headers) => ({
937
+ ...headers
938
+ });
939
+ var withTimeoutFetch = (timeoutMs) => {
940
+ const timeout = timeoutMs ?? DEFAULT_TIMEOUT;
941
+ return async (input, init) => {
942
+ if (typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function") {
943
+ const timeoutSignal = AbortSignal.timeout(timeout);
944
+ if (!init?.signal) {
945
+ return fetch(input, { ...init, signal: timeoutSignal });
946
+ }
947
+ const controller2 = new AbortController;
948
+ const abort = () => controller2.abort();
949
+ timeoutSignal.addEventListener("abort", abort, { once: true });
950
+ init.signal.addEventListener("abort", abort, { once: true });
951
+ const signal2 = controller2.signal;
952
+ return fetch(input, { ...init, signal: signal2 });
953
+ }
954
+ const controller = new AbortController;
955
+ const timer = setTimeout(() => controller.abort(), timeout);
956
+ init?.signal?.addEventListener("abort", () => controller.abort(), { once: true });
957
+ const signal = controller.signal;
958
+ try {
959
+ return await fetch(input, { ...init, signal });
960
+ } finally {
961
+ clearTimeout(timer);
962
+ }
963
+ };
964
+ };
965
+ var toClientConfig = (config) => ({
966
+ baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
967
+ fetch: withTimeoutFetch(config.timeout),
968
+ headers: {
969
+ ...mergeHeaders2(config.headers),
970
+ ...config.apiKey ? { "X-API-Key": config.apiKey } : {}
971
+ }
972
+ });
973
+ var setRuntimeConfig = (config) => {
974
+ return toClientConfig({
975
+ ...defaultRuntimeConfig,
976
+ ...config,
977
+ headers: {
978
+ ...defaultRuntimeConfig.headers,
979
+ ...mergeHeaders2(config.headers)
980
+ }
981
+ });
982
+ };
983
+ var createClientConfig = (override = {}) => ({
984
+ ...toClientConfig(defaultRuntimeConfig),
985
+ ...override,
986
+ headers: {
987
+ ...toClientConfig(defaultRuntimeConfig).headers,
988
+ ...override.headers ?? {}
989
+ }
990
+ });
991
+
992
+ // src/gen/client.gen.ts
993
+ var client = createClient(createClientConfig(createConfig()));
994
+
995
+ // src/gen/sdk.gen.ts
996
+ var getProjectInfo = (options) => (options.client ?? client).get({ url: "/api/v1/project", ...options });
997
+ var getProjectMembers = (options) => (options.client ?? client).get({ url: "/api/v1/project/members", ...options });
998
+ var getApiKeys = (options) => (options.client ?? client).get({ url: "/api/v1/project/api-keys", ...options });
999
+ var createApiKey = (options) => (options.client ?? client).post({
1000
+ url: "/api/v1/project/api-keys",
1001
+ ...options,
1002
+ headers: {
1003
+ "Content-Type": "application/json",
1004
+ ...options.headers
1005
+ }
1006
+ });
1007
+ var deleteApiKey = (options) => (options.client ?? client).delete({ url: "/api/v1/project/api-keys/{apiKeyId}", ...options });
1008
+ var updateApiKey = (options) => (options.client ?? client).patch({
1009
+ url: "/api/v1/project/api-keys/{apiKeyId}",
1010
+ ...options,
1011
+ headers: {
1012
+ "Content-Type": "application/json",
1013
+ ...options.headers
1014
+ }
1015
+ });
1016
+ var findAll = (options) => (options.client ?? client).get({ url: "/api/v1/lists", ...options });
1017
+ var create = (options) => (options.client ?? client).post({
1018
+ url: "/api/v1/lists",
1019
+ ...options,
1020
+ headers: {
1021
+ "Content-Type": "application/json",
1022
+ ...options.headers
1023
+ }
1024
+ });
1025
+ var remove = (options) => (options.client ?? client).delete({ url: "/api/v1/lists/{listId}", ...options });
1026
+ var findOne = (options) => (options.client ?? client).get({ url: "/api/v1/lists/{listId}", ...options });
1027
+ var update = (options) => (options.client ?? client).patch({
1028
+ url: "/api/v1/lists/{listId}",
1029
+ ...options,
1030
+ headers: {
1031
+ "Content-Type": "application/json",
1032
+ ...options.headers
1033
+ }
1034
+ });
1035
+ var getRecipients = (options) => (options.client ?? client).get({ url: "/api/v1/lists/{listId}/recipients", ...options });
1036
+ var addRecipient = (options) => (options.client ?? client).post({
1037
+ url: "/api/v1/lists/{listId}/recipients",
1038
+ ...options,
1039
+ headers: {
1040
+ "Content-Type": "application/json",
1041
+ ...options.headers
1042
+ }
1043
+ });
1044
+ var addRecipientsBulk = (options) => (options.client ?? client).post({
1045
+ url: "/api/v1/lists/{listId}/recipients/bulk",
1046
+ ...options,
1047
+ headers: {
1048
+ "Content-Type": "application/json",
1049
+ ...options.headers
1050
+ }
1051
+ });
1052
+ var removeRecipient = (options) => (options.client ?? client).delete({ url: "/api/v1/lists/{listId}/recipients/{recipientId}", ...options });
1053
+ var importFromFile = (options) => (options.client ?? client).post({
1054
+ ...formDataBodySerializer,
1055
+ url: "/api/v1/lists/{listId}/import",
1056
+ ...options,
1057
+ headers: {
1058
+ "Content-Type": null,
1059
+ ...options.headers
1060
+ }
1061
+ });
1062
+ var createDistributionList = (options) => (options.client ?? client).post({
1063
+ url: "/api/v1/lists/distribution",
1064
+ ...options,
1065
+ headers: {
1066
+ "Content-Type": "application/json",
1067
+ ...options.headers
1068
+ }
1069
+ });
1070
+ var validateDistributionRecipients = (options) => (options.client ?? client).post({
1071
+ url: "/api/v1/lists/distribution/validate",
1072
+ ...options,
1073
+ headers: {
1074
+ "Content-Type": "application/json",
1075
+ ...options.headers
1076
+ }
1077
+ });
1078
+ var importCsvDistribution = (options) => (options.client ?? client).post({
1079
+ url: "/api/v1/lists/distribution/csv",
1080
+ ...options,
1081
+ headers: {
1082
+ "Content-Type": "application/json",
1083
+ ...options.headers
1084
+ }
1085
+ });
1086
+ var distribute = (options) => (options.client ?? client).post({
1087
+ url: "/api/v1/distribute",
1088
+ ...options,
1089
+ headers: {
1090
+ "Content-Type": "application/json",
1091
+ ...options.headers
1092
+ }
1093
+ });
1094
+ var findAll2 = (options) => (options.client ?? client).get({ url: "/api/v1/distributions", ...options });
1095
+ var create2 = (options) => (options.client ?? client).post({
1096
+ url: "/api/v1/distributions",
1097
+ ...options,
1098
+ headers: {
1099
+ "Content-Type": "application/json",
1100
+ ...options.headers
1101
+ }
1102
+ });
1103
+ var findOne2 = (options) => (options.client ?? client).get({ url: "/api/v1/distributions/{id}", ...options });
1104
+ var update2 = (options) => (options.client ?? client).patch({
1105
+ url: "/api/v1/distributions/{id}",
1106
+ ...options,
1107
+ headers: {
1108
+ "Content-Type": "application/json",
1109
+ ...options.headers
1110
+ }
1111
+ });
1112
+ var updateRecipients = (options) => (options.client ?? client).patch({
1113
+ url: "/api/v1/distributions/{id}/recipients",
1114
+ ...options,
1115
+ headers: {
1116
+ "Content-Type": "application/json",
1117
+ ...options.headers
1118
+ }
1119
+ });
1120
+ var prepareTransactions = (options) => (options.client ?? client).post({
1121
+ url: "/api/v1/distributions/{id}/prepare",
1122
+ ...options,
1123
+ headers: {
1124
+ "Content-Type": "application/json",
1125
+ ...options.headers
1126
+ }
1127
+ });
1128
+ var getTransactions = (options) => (options.client ?? client).get({ url: "/api/v1/distributions/{id}/transactions", ...options });
1129
+ var getStats = (options) => (options.client ?? client).get({ url: "/api/v1/distributions/{id}/stats", ...options });
1130
+ var cancel = (options) => (options.client ?? client).post({ url: "/api/v1/distributions/{id}/cancel", ...options });
1131
+ var getApproveCalldata = (options) => (options.client ?? client).post({
1132
+ url: "/api/v1/approve-calldata",
1133
+ ...options,
1134
+ headers: {
1135
+ "Content-Type": "application/json",
1136
+ ...options.headers
1137
+ }
1138
+ });
1139
+ var getApproveCalldataForDistribution = (options) => (options.client ?? client).get({ url: "/api/v1/distributions/{id}/approve-calldata", ...options });
1140
+ var getChains = (options) => (options.client ?? client).get({ url: "/api/v1/catalogs/chains", ...options });
1141
+ var getChain = (options) => (options.client ?? client).get({ url: "/api/v1/catalogs/chains/{chainId}", ...options });
1142
+ var getTokens = (options) => (options.client ?? client).get({ url: "/api/v1/catalogs/tokens", ...options });
1143
+ var searchTokens = (options) => (options.client ?? client).get({ url: "/api/v1/catalogs/tokens/search", ...options });
1144
+ var getToken = (options) => (options.client ?? client).get({ url: "/api/v1/catalogs/tokens/{chainId}/{address}", ...options });
1145
+
1146
+ //# debugId=D24D401CDE35180164756E2164756E21