@safe-global/api-kit 3.0.0-alpha.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,9 +75,11 @@ var TRANSACTION_SERVICE_URLS = {
75
75
  "10": "https://safe-transaction-optimism.safe.global/api",
76
76
  "56": "https://safe-transaction-bsc.safe.global/api",
77
77
  "100": "https://safe-transaction-gnosis-chain.safe.global/api",
78
+ "130": "https://safe-transaction-unichain.safe.global/api",
78
79
  "137": "https://safe-transaction-polygon.safe.global/api",
79
80
  "196": "https://safe-transaction-xlayer.safe.global/api",
80
81
  "324": "https://safe-transaction-zksync.safe.global/api",
82
+ "480": "https://safe-transaction-worldchain.safe.global/api",
81
83
  "1101": "https://safe-transaction-zkevm.safe.global/api",
82
84
  "5000": "https://safe-transaction-mantle.safe.global/api",
83
85
  "8453": "https://safe-transaction-base.safe.global/api",
@@ -117,6 +119,11 @@ var isSafeOperation = (obj) => {
117
119
  return "signatures" in obj && "getUserOperation" in obj && "getHash" in obj;
118
120
  };
119
121
 
122
+ // src/utils/queryParamsMap.ts
123
+ var QUERY_PARAMS_MAP = {
124
+ from: "_from"
125
+ };
126
+
120
127
  // src/SafeApiKit.ts
121
128
  var SafeApiKit = class {
122
129
  #chainId;
@@ -146,6 +153,24 @@ var SafeApiKit = class {
146
153
  #getEip3770Address(fullAddress) {
147
154
  return validateEip3770Address(fullAddress, this.#chainId);
148
155
  }
156
+ /**
157
+ * Adds query parameters from an options object to a given URL.
158
+ * Converts parameter names to snake_case automatically. If a specific mapping exists in QUERY_PARAMS_MAP,
159
+ * it will be used instead of the converted name.
160
+ *
161
+ * @param {URL} url - The URL object to which query parameters will be added.
162
+ * @param {T} options - An object containing key-value pairs representing query parameters.
163
+ * @returns {void}
164
+ */
165
+ #addUrlQueryParams(url, options) {
166
+ const camelToSnake = (str) => str.replace(/([A-Z])/g, "_$1").toLowerCase();
167
+ Object.entries(options || {}).forEach(([key, value]) => {
168
+ if (value !== void 0) {
169
+ const name = QUERY_PARAMS_MAP[key] ?? camelToSnake(key);
170
+ url.searchParams.set(name, value.toString());
171
+ }
172
+ });
173
+ }
149
174
  /**
150
175
  * Returns the information and configuration of the service.
151
176
  *
@@ -192,125 +217,6 @@ var SafeApiKit = class {
192
217
  body: dataDecoderRequest
193
218
  });
194
219
  }
195
- /**
196
- * Returns the list of Safes where the address provided is an owner.
197
- *
198
- * @param ownerAddress - The owner address
199
- * @returns The list of Safes where the address provided is an owner
200
- * @throws "Invalid owner address"
201
- * @throws "Checksum address validation failed"
202
- */
203
- async getSafesByOwner(ownerAddress) {
204
- if (ownerAddress === "") {
205
- throw new Error("Invalid owner address");
206
- }
207
- const { address } = this.#getEip3770Address(ownerAddress);
208
- return sendRequest({
209
- url: `${this.#txServiceBaseUrl}/v1/owners/${address}/safes/`,
210
- method: "get" /* Get */
211
- });
212
- }
213
- /**
214
- * Returns the list of Safes where the module address provided is enabled.
215
- *
216
- * @param moduleAddress - The Safe module address
217
- * @returns The list of Safe addresses where the module provided is enabled
218
- * @throws "Invalid module address"
219
- * @throws "Module address checksum not valid"
220
- */
221
- async getSafesByModule(moduleAddress) {
222
- if (moduleAddress === "") {
223
- throw new Error("Invalid module address");
224
- }
225
- const { address } = this.#getEip3770Address(moduleAddress);
226
- return sendRequest({
227
- url: `${this.#txServiceBaseUrl}/v1/modules/${address}/safes/`,
228
- method: "get" /* Get */
229
- });
230
- }
231
- /**
232
- * Returns all the information of a Safe transaction.
233
- *
234
- * @param safeTxHash - Hash of the Safe transaction
235
- * @returns The information of a Safe transaction
236
- * @throws "Invalid safeTxHash"
237
- * @throws "Not found."
238
- */
239
- async getTransaction(safeTxHash) {
240
- if (safeTxHash === "") {
241
- throw new Error("Invalid safeTxHash");
242
- }
243
- return sendRequest({
244
- url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/`,
245
- method: "get" /* Get */
246
- });
247
- }
248
- /**
249
- * Returns the list of confirmations for a given a Safe transaction.
250
- *
251
- * @param safeTxHash - The hash of the Safe transaction
252
- * @returns The list of confirmations
253
- * @throws "Invalid safeTxHash"
254
- */
255
- async getTransactionConfirmations(safeTxHash) {
256
- if (safeTxHash === "") {
257
- throw new Error("Invalid safeTxHash");
258
- }
259
- return sendRequest({
260
- url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/confirmations/`,
261
- method: "get" /* Get */
262
- });
263
- }
264
- /**
265
- * Adds a confirmation for a Safe transaction.
266
- *
267
- * @param safeTxHash - Hash of the Safe transaction that will be confirmed
268
- * @param signature - Signature of the transaction
269
- * @returns
270
- * @throws "Invalid safeTxHash"
271
- * @throws "Invalid signature"
272
- * @throws "Malformed data"
273
- * @throws "Error processing data"
274
- */
275
- async confirmTransaction(safeTxHash, signature) {
276
- if (safeTxHash === "") {
277
- throw new Error("Invalid safeTxHash");
278
- }
279
- if (signature === "") {
280
- throw new Error("Invalid signature");
281
- }
282
- return sendRequest({
283
- url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/confirmations/`,
284
- method: "post" /* Post */,
285
- body: {
286
- signature
287
- }
288
- });
289
- }
290
- /**
291
- * Returns the information and configuration of the provided Safe address.
292
- *
293
- * @param safeAddress - The Safe address
294
- * @returns The information and configuration of the provided Safe address
295
- * @throws "Invalid Safe address"
296
- * @throws "Checksum address validation failed"
297
- */
298
- async getSafeInfo(safeAddress) {
299
- if (safeAddress === "") {
300
- throw new Error("Invalid Safe address");
301
- }
302
- const { address } = this.#getEip3770Address(safeAddress);
303
- return sendRequest({
304
- url: `${this.#txServiceBaseUrl}/v1/safes/${address}/`,
305
- method: "get" /* Get */
306
- }).then((response) => {
307
- if (!response?.singleton) {
308
- const { masterCopy, ...rest } = response;
309
- return { ...rest, singleton: masterCopy };
310
- }
311
- return response;
312
- });
313
- }
314
220
  /**
315
221
  * Returns the list of delegates.
316
222
  *
@@ -432,6 +338,189 @@ var SafeApiKit = class {
432
338
  }
433
339
  });
434
340
  }
341
+ /**
342
+ * Get a message by its safe message hash
343
+ * @param messageHash The Safe message hash
344
+ * @returns The message
345
+ */
346
+ async getMessage(messageHash) {
347
+ if (!messageHash) {
348
+ throw new Error("Invalid messageHash");
349
+ }
350
+ return sendRequest({
351
+ url: `${this.#txServiceBaseUrl}/v1/messages/${messageHash}/`,
352
+ method: "get" /* Get */
353
+ });
354
+ }
355
+ /**
356
+ * Get the list of messages associated to a Safe account
357
+ * @param safeAddress The safe address
358
+ * @param options The options to filter the list of messages
359
+ * @returns The paginated list of messages
360
+ */
361
+ async getMessages(safeAddress, options = {}) {
362
+ if (!this.#isValidAddress(safeAddress)) {
363
+ throw new Error("Invalid safeAddress");
364
+ }
365
+ const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${safeAddress}/messages/`);
366
+ this.#addUrlQueryParams(url, options);
367
+ return sendRequest({
368
+ url: url.toString(),
369
+ method: "get" /* Get */
370
+ });
371
+ }
372
+ /**
373
+ * Creates a new message with an initial signature
374
+ * Add more signatures from other owners using addMessageSignature()
375
+ * @param safeAddress The safe address
376
+ * @param options The raw message to add, signature and safeAppId if any
377
+ */
378
+ async addMessage(safeAddress, addMessageOptions) {
379
+ if (!this.#isValidAddress(safeAddress)) {
380
+ throw new Error("Invalid safeAddress");
381
+ }
382
+ return sendRequest({
383
+ url: `${this.#txServiceBaseUrl}/v1/safes/${safeAddress}/messages/`,
384
+ method: "post" /* Post */,
385
+ body: addMessageOptions
386
+ });
387
+ }
388
+ /**
389
+ * Add a signature to an existing message
390
+ * @param messageHash The safe message hash
391
+ * @param signature The signature
392
+ */
393
+ async addMessageSignature(messageHash, signature) {
394
+ if (!messageHash || !signature) {
395
+ throw new Error("Invalid messageHash or signature");
396
+ }
397
+ return sendRequest({
398
+ url: `${this.#txServiceBaseUrl}/v1/messages/${messageHash}/signatures/`,
399
+ method: "post" /* Post */,
400
+ body: {
401
+ signature
402
+ }
403
+ });
404
+ }
405
+ /**
406
+ * Returns the list of Safes where the address provided is an owner.
407
+ *
408
+ * @param ownerAddress - The owner address
409
+ * @returns The list of Safes where the address provided is an owner
410
+ * @throws "Invalid owner address"
411
+ * @throws "Checksum address validation failed"
412
+ */
413
+ async getSafesByOwner(ownerAddress) {
414
+ if (ownerAddress === "") {
415
+ throw new Error("Invalid owner address");
416
+ }
417
+ const { address } = this.#getEip3770Address(ownerAddress);
418
+ return sendRequest({
419
+ url: `${this.#txServiceBaseUrl}/v1/owners/${address}/safes/`,
420
+ method: "get" /* Get */
421
+ });
422
+ }
423
+ /**
424
+ * Returns the list of Safes where the module address provided is enabled.
425
+ *
426
+ * @param moduleAddress - The Safe module address
427
+ * @returns The list of Safe addresses where the module provided is enabled
428
+ * @throws "Invalid module address"
429
+ * @throws "Module address checksum not valid"
430
+ */
431
+ async getSafesByModule(moduleAddress) {
432
+ if (moduleAddress === "") {
433
+ throw new Error("Invalid module address");
434
+ }
435
+ const { address } = this.#getEip3770Address(moduleAddress);
436
+ return sendRequest({
437
+ url: `${this.#txServiceBaseUrl}/v1/modules/${address}/safes/`,
438
+ method: "get" /* Get */
439
+ });
440
+ }
441
+ /**
442
+ * Returns all the information of a Safe transaction.
443
+ *
444
+ * @param safeTxHash - Hash of the Safe transaction
445
+ * @returns The information of a Safe transaction
446
+ * @throws "Invalid safeTxHash"
447
+ * @throws "Not found."
448
+ */
449
+ async getTransaction(safeTxHash) {
450
+ if (safeTxHash === "") {
451
+ throw new Error("Invalid safeTxHash");
452
+ }
453
+ return sendRequest({
454
+ url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/`,
455
+ method: "get" /* Get */
456
+ });
457
+ }
458
+ /**
459
+ * Returns the list of confirmations for a given a Safe transaction.
460
+ *
461
+ * @param safeTxHash - The hash of the Safe transaction
462
+ * @returns The list of confirmations
463
+ * @throws "Invalid safeTxHash"
464
+ */
465
+ async getTransactionConfirmations(safeTxHash) {
466
+ if (safeTxHash === "") {
467
+ throw new Error("Invalid safeTxHash");
468
+ }
469
+ return sendRequest({
470
+ url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/confirmations/`,
471
+ method: "get" /* Get */
472
+ });
473
+ }
474
+ /**
475
+ * Adds a confirmation for a Safe transaction.
476
+ *
477
+ * @param safeTxHash - Hash of the Safe transaction that will be confirmed
478
+ * @param signature - Signature of the transaction
479
+ * @returns
480
+ * @throws "Invalid safeTxHash"
481
+ * @throws "Invalid signature"
482
+ * @throws "Malformed data"
483
+ * @throws "Error processing data"
484
+ */
485
+ async confirmTransaction(safeTxHash, signature) {
486
+ if (safeTxHash === "") {
487
+ throw new Error("Invalid safeTxHash");
488
+ }
489
+ if (signature === "") {
490
+ throw new Error("Invalid signature");
491
+ }
492
+ return sendRequest({
493
+ url: `${this.#txServiceBaseUrl}/v1/multisig-transactions/${safeTxHash}/confirmations/`,
494
+ method: "post" /* Post */,
495
+ body: {
496
+ signature
497
+ }
498
+ });
499
+ }
500
+ /**
501
+ * Returns the information and configuration of the provided Safe address.
502
+ *
503
+ * @param safeAddress - The Safe address
504
+ * @returns The information and configuration of the provided Safe address
505
+ * @throws "Invalid Safe address"
506
+ * @throws "Checksum address validation failed"
507
+ */
508
+ async getSafeInfo(safeAddress) {
509
+ if (safeAddress === "") {
510
+ throw new Error("Invalid Safe address");
511
+ }
512
+ const { address } = this.#getEip3770Address(safeAddress);
513
+ return sendRequest({
514
+ url: `${this.#txServiceBaseUrl}/v1/safes/${address}/`,
515
+ method: "get" /* Get */
516
+ }).then((response) => {
517
+ if (!response?.singleton) {
518
+ const { masterCopy, ...rest } = response;
519
+ return { ...rest, singleton: masterCopy };
520
+ }
521
+ return response;
522
+ });
523
+ }
435
524
  /**
436
525
  * Returns the creation information of a Safe.
437
526
  *
@@ -522,17 +611,20 @@ var SafeApiKit = class {
522
611
  * Returns the history of incoming transactions of a Safe account.
523
612
  *
524
613
  * @param safeAddress - The Safe address
614
+ * @param options - Optional parameters to filter or modify the response
525
615
  * @returns The history of incoming transactions
526
616
  * @throws "Invalid Safe address"
527
617
  * @throws "Checksum address validation failed"
528
618
  */
529
- async getIncomingTransactions(safeAddress) {
619
+ async getIncomingTransactions(safeAddress, options) {
530
620
  if (safeAddress === "") {
531
621
  throw new Error("Invalid Safe address");
532
622
  }
533
623
  const { address } = this.#getEip3770Address(safeAddress);
624
+ const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${address}/incoming-transfers/`);
625
+ this.#addUrlQueryParams(url, options);
534
626
  return sendRequest({
535
- url: `${this.#txServiceBaseUrl}/v1/safes/${address}/incoming-transfers?executed=true`,
627
+ url: url.toString(),
536
628
  method: "get" /* Get */
537
629
  });
538
630
  }
@@ -540,18 +632,21 @@ var SafeApiKit = class {
540
632
  * Returns the history of module transactions of a Safe account.
541
633
  *
542
634
  * @param safeAddress - The Safe address
635
+ * @param options - Optional parameters to filter or modify the response
543
636
  * @returns The history of module transactions
544
637
  * @throws "Invalid Safe address"
545
638
  * @throws "Invalid data"
546
639
  * @throws "Invalid ethereum address"
547
640
  */
548
- async getModuleTransactions(safeAddress) {
641
+ async getModuleTransactions(safeAddress, options) {
549
642
  if (safeAddress === "") {
550
643
  throw new Error("Invalid Safe address");
551
644
  }
552
645
  const { address } = this.#getEip3770Address(safeAddress);
646
+ const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${address}/module-transactions/`);
647
+ this.#addUrlQueryParams(url, options);
553
648
  return sendRequest({
554
- url: `${this.#txServiceBaseUrl}/v1/safes/${address}/module-transactions/`,
649
+ url: url.toString(),
555
650
  method: "get" /* Get */
556
651
  });
557
652
  }
@@ -559,38 +654,38 @@ var SafeApiKit = class {
559
654
  * Returns the history of multi-signature transactions of a Safe account.
560
655
  *
561
656
  * @param safeAddress - The Safe address
657
+ * @param options - Optional parameters to filter or modify the response
562
658
  * @returns The history of multi-signature transactions
563
659
  * @throws "Invalid Safe address"
564
660
  * @throws "Checksum address validation failed"
565
661
  */
566
- async getMultisigTransactions(safeAddress) {
662
+ async getMultisigTransactions(safeAddress, options) {
567
663
  if (safeAddress === "") {
568
664
  throw new Error("Invalid Safe address");
569
665
  }
570
666
  const { address } = this.#getEip3770Address(safeAddress);
667
+ const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${address}/multisig-transactions/`);
668
+ this.#addUrlQueryParams(url, options);
571
669
  return sendRequest({
572
- url: `${this.#txServiceBaseUrl}/v1/safes/${address}/multisig-transactions/`,
670
+ url: url.toString(),
573
671
  method: "get" /* Get */
574
672
  });
575
673
  }
576
- async getPendingTransactions(safeAddress, propsOrCurrentNonce = {}) {
674
+ /**
675
+ * Returns the list of multi-signature transactions that are waiting for the confirmation of the Safe owners.
676
+ *
677
+ * @param safeAddress - The Safe address
678
+ * @param {PendingTransactionsOptions} options The options to filter the list of transactions
679
+ * @returns The list of transactions waiting for the confirmation of the Safe owners
680
+ * @throws "Invalid Safe address"
681
+ * @throws "Invalid data"
682
+ * @throws "Invalid ethereum address"
683
+ */
684
+ async getPendingTransactions(safeAddress, options = {}) {
577
685
  if (safeAddress === "") {
578
686
  throw new Error("Invalid Safe address");
579
687
  }
580
- let currentNonce;
581
- let hasConfirmations;
582
- let ordering;
583
- let limit;
584
- let offset;
585
- if (typeof propsOrCurrentNonce === "object") {
586
- ;
587
- ({ currentNonce, hasConfirmations, ordering, limit, offset } = propsOrCurrentNonce);
588
- } else {
589
- console.warn(
590
- "Deprecated: Use `currentNonce` inside an object instead. See `PendingTransactionsOptions`."
591
- );
592
- currentNonce = propsOrCurrentNonce;
593
- }
688
+ const { currentNonce, hasConfirmations, ordering, limit, offset } = options;
594
689
  const { address } = this.#getEip3770Address(safeAddress);
595
690
  const nonce = currentNonce ? currentNonce : (await this.getSafeInfo(address)).nonce;
596
691
  const url = new URL(
@@ -617,9 +712,11 @@ var SafeApiKit = class {
617
712
  * Returns a list of transactions for a Safe. The list has different structures depending on the transaction type
618
713
  *
619
714
  * @param safeAddress - The Safe address
715
+ * @param options - Optional parameters to filter or modify the response
620
716
  * @returns The list of transactions waiting for the confirmation of the Safe owners
621
717
  * @throws "Invalid Safe address"
622
718
  * @throws "Checksum address validation failed"
719
+ * @throws "Ordering field is not valid"
623
720
  */
624
721
  async getAllTransactions(safeAddress, options) {
625
722
  if (safeAddress === "") {
@@ -627,12 +724,7 @@ var SafeApiKit = class {
627
724
  }
628
725
  const { address } = this.#getEip3770Address(safeAddress);
629
726
  const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${address}/all-transactions/`);
630
- const trusted = options?.trusted?.toString() || "true";
631
- url.searchParams.set("trusted", trusted);
632
- const queued = options?.queued?.toString() || "true";
633
- url.searchParams.set("queued", queued);
634
- const executed = options?.executed?.toString() || "false";
635
- url.searchParams.set("executed", executed);
727
+ this.#addUrlQueryParams(url, options);
636
728
  return sendRequest({
637
729
  url: url.toString(),
638
730
  method: "get" /* Get */
@@ -666,11 +758,14 @@ var SafeApiKit = class {
666
758
  /**
667
759
  * Returns the list of all the ERC20 tokens handled by the Safe.
668
760
  *
761
+ * @param options - Optional parameters to filter or modify the response
669
762
  * @returns The list of all the ERC20 tokens
670
763
  */
671
- async getTokenList() {
764
+ async getTokenList(options) {
765
+ const url = new URL(`${this.#txServiceBaseUrl}/v1/tokens/`);
766
+ this.#addUrlQueryParams(url, options);
672
767
  return sendRequest({
673
- url: `${this.#txServiceBaseUrl}/v1/tokens/`,
768
+ url: url.toString(),
674
769
  method: "get" /* Get */
675
770
  });
676
771
  }
@@ -692,113 +787,21 @@ var SafeApiKit = class {
692
787
  method: "get" /* Get */
693
788
  });
694
789
  }
695
- /**
696
- * Get a message by its safe message hash
697
- * @param messageHash The Safe message hash
698
- * @returns The message
699
- */
700
- async getMessage(messageHash) {
701
- if (!messageHash) {
702
- throw new Error("Invalid messageHash");
703
- }
704
- return sendRequest({
705
- url: `${this.#txServiceBaseUrl}/v1/messages/${messageHash}/`,
706
- method: "get" /* Get */
707
- });
708
- }
709
- /**
710
- * Get the list of messages associated to a Safe account
711
- * @param safeAddress The safe address
712
- * @param options The options to filter the list of messages
713
- * @returns The paginated list of messages
714
- */
715
- async getMessages(safeAddress, { ordering, limit, offset } = {}) {
716
- if (!this.#isValidAddress(safeAddress)) {
717
- throw new Error("Invalid safeAddress");
718
- }
719
- const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${safeAddress}/messages/`);
720
- if (ordering) {
721
- url.searchParams.set("ordering", ordering);
722
- }
723
- if (limit != null) {
724
- url.searchParams.set("limit", limit.toString());
725
- }
726
- if (offset != null) {
727
- url.searchParams.set("offset", offset.toString());
728
- }
729
- return sendRequest({
730
- url: url.toString(),
731
- method: "get" /* Get */
732
- });
733
- }
734
- /**
735
- * Creates a new message with an initial signature
736
- * Add more signatures from other owners using addMessageSignature()
737
- * @param safeAddress The safe address
738
- * @param options The raw message to add, signature and safeAppId if any
739
- */
740
- async addMessage(safeAddress, addMessageProps) {
741
- if (!this.#isValidAddress(safeAddress)) {
742
- throw new Error("Invalid safeAddress");
743
- }
744
- return sendRequest({
745
- url: `${this.#txServiceBaseUrl}/v1/safes/${safeAddress}/messages/`,
746
- method: "post" /* Post */,
747
- body: addMessageProps
748
- });
749
- }
750
- /**
751
- * Add a signature to an existing message
752
- * @param messageHash The safe message hash
753
- * @param signature The signature
754
- */
755
- async addMessageSignature(messageHash, signature) {
756
- if (!messageHash || !signature) {
757
- throw new Error("Invalid messageHash or signature");
758
- }
759
- return sendRequest({
760
- url: `${this.#txServiceBaseUrl}/v1/messages/${messageHash}/signatures/`,
761
- method: "post" /* Post */,
762
- body: {
763
- signature
764
- }
765
- });
766
- }
767
790
  /**
768
791
  * Get the SafeOperations that were sent from a particular address.
769
- * @param getSafeOperationsProps - The parameters to filter the list of SafeOperations
792
+ * @param safeAddress - The Safe address
793
+ * @param options - Optional parameters to filter or modify the response
770
794
  * @throws "Safe address must not be empty"
771
795
  * @throws "Invalid Ethereum address {safeAddress}"
772
796
  * @returns The SafeOperations sent from the given Safe's address
773
797
  */
774
- async getSafeOperationsByAddress({
775
- safeAddress,
776
- executed,
777
- hasConfirmations,
778
- ordering,
779
- limit,
780
- offset
781
- }) {
798
+ async getSafeOperationsByAddress(safeAddress, options) {
782
799
  if (!safeAddress) {
783
800
  throw new Error("Safe address must not be empty");
784
801
  }
785
802
  const { address } = this.#getEip3770Address(safeAddress);
786
803
  const url = new URL(`${this.#txServiceBaseUrl}/v1/safes/${address}/safe-operations/`);
787
- if (ordering) {
788
- url.searchParams.set("ordering", ordering);
789
- }
790
- if (limit != null) {
791
- url.searchParams.set("limit", limit.toString());
792
- }
793
- if (offset != null) {
794
- url.searchParams.set("offset", offset.toString());
795
- }
796
- if (hasConfirmations != null) {
797
- url.searchParams.set("has_confirmations", hasConfirmations.toString());
798
- }
799
- if (executed != null) {
800
- url.searchParams.set("executed", executed.toString());
801
- }
804
+ this.#addUrlQueryParams(url, options);
802
805
  return sendRequest({
803
806
  url: url.toString(),
804
807
  method: "get" /* Get */
@@ -806,14 +809,15 @@ var SafeApiKit = class {
806
809
  }
807
810
  /**
808
811
  * Get the SafeOperations that are pending to send to the bundler
809
- * @param getSafeOperationsProps - The parameters to filter the list of SafeOperations
812
+ * @param safeAddress - The Safe address
813
+ * @param options - Optional parameters to filter or modify the response
810
814
  * @throws "Safe address must not be empty"
811
815
  * @throws "Invalid Ethereum address {safeAddress}"
812
816
  * @returns The pending SafeOperations
813
817
  */
814
- async getPendingSafeOperations(props) {
815
- return this.getSafeOperationsByAddress({
816
- ...props,
818
+ async getPendingSafeOperations(safeAddress, options) {
819
+ return this.getSafeOperationsByAddress(safeAddress, {
820
+ ...options,
817
821
  executed: false
818
822
  });
819
823
  }
@@ -954,7 +958,7 @@ var SafeApiKit = class {
954
958
  var SafeApiKit_default = SafeApiKit;
955
959
 
956
960
  // src/index.ts
957
- var src_default = SafeApiKit_default;
961
+ var index_default = SafeApiKit_default;
958
962
  export {
959
- src_default as default
963
+ index_default as default
960
964
  };