algokit-utils 3.0.0b10__py3-none-any.whl → 3.0.0b11__py3-none-any.whl

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.

Potentially problematic release.


This version of algokit-utils might be problematic. Click here for more details.

@@ -59,15 +59,28 @@ class SendSingleTransactionResult:
59
59
  """
60
60
 
61
61
  transaction: TransactionWrapper # Last transaction
62
+ """The last transaction"""
63
+
62
64
  confirmation: algosdk.v2client.algod.AlgodResponseType # Last confirmation
65
+ """The last confirmation"""
63
66
 
64
67
  # Fields from SendAtomicTransactionComposerResults
65
68
  group_id: str
69
+ """The group ID"""
70
+
66
71
  tx_id: str | None = None
72
+ """The transaction ID"""
73
+
67
74
  tx_ids: list[str] # Full array of transaction IDs
75
+ """The full array of transaction IDs"""
68
76
  transactions: list[TransactionWrapper]
77
+ """The full array of transactions"""
78
+
69
79
  confirmations: list[algosdk.v2client.algod.AlgodResponseType]
80
+ """The full array of confirmations"""
81
+
70
82
  returns: list[ABIReturn] | None = None
83
+ """The ABI return value if applicable"""
71
84
 
72
85
  @classmethod
73
86
  def from_composer_result(cls, result: SendAtomicTransactionComposerResults, index: int = -1) -> Self:
@@ -111,6 +124,7 @@ class SendSingleAssetCreateTransactionResult(SendSingleTransactionResult):
111
124
  """
112
125
 
113
126
  asset_id: int
127
+ """The ID of the newly created asset"""
114
128
 
115
129
 
116
130
  ABIReturnT = TypeVar("ABIReturnT")
@@ -124,6 +138,7 @@ class SendAppTransactionResult(SendSingleTransactionResult, Generic[ABIReturnT])
124
138
  """
125
139
 
126
140
  abi_return: ABIReturnT | None = None
141
+ """The ABI return value if applicable"""
127
142
 
128
143
 
129
144
  @dataclass(frozen=True)
@@ -134,7 +149,10 @@ class SendAppUpdateTransactionResult(SendAppTransactionResult[ABIReturnT]):
134
149
  """
135
150
 
136
151
  compiled_approval: Any | None = None
152
+ """The compiled approval program"""
153
+
137
154
  compiled_clear: Any | None = None
155
+ """The compiled clear state program"""
138
156
 
139
157
 
140
158
  @dataclass(frozen=True, kw_only=True)
@@ -145,7 +163,10 @@ class SendAppCreateTransactionResult(SendAppUpdateTransactionResult[ABIReturnT])
145
163
  """
146
164
 
147
165
  app_id: int
166
+ """The ID of the newly created application"""
167
+
148
168
  app_address: str
169
+ """The address of the newly created application"""
149
170
 
150
171
 
151
172
  class AlgorandClientTransactionSender:
@@ -171,6 +192,12 @@ class AlgorandClientTransactionSender:
171
192
  """Create a new transaction group.
172
193
 
173
194
  :return: A new TransactionComposer instance
195
+
196
+ :example:
197
+ >>> sender = AlgorandClientTransactionSender(new_group, asset_manager, app_manager, algod_client)
198
+ >>> composer = sender.new_group()
199
+ >>> composer(PaymentParams(sender="sender", receiver="receiver", amount=AlgoAmount(algo=1)))
200
+ >>> composer.send()
174
201
  """
175
202
  return self._new_group()
176
203
 
@@ -292,6 +319,33 @@ class AlgorandClientTransactionSender:
292
319
  :param params: Payment transaction parameters
293
320
  :param send_params: Send parameters
294
321
  :return: Result of the payment transaction
322
+
323
+ :example:
324
+ >>> result = algorand.send.payment(PaymentParams(
325
+ >>> sender="SENDERADDRESS",
326
+ >>> receiver="RECEIVERADDRESS",
327
+ >>> amount=AlgoAmount(algo=4),
328
+ >>> ))
329
+
330
+ >>> # Advanced example
331
+ >>> result = algorand.send.payment(PaymentParams(
332
+ >>> amount=AlgoAmount(algo=4),
333
+ >>> receiver="RECEIVERADDRESS",
334
+ >>> sender="SENDERADDRESS",
335
+ >>> close_remainder_to="CLOSEREMAINDERTOADDRESS",
336
+ >>> lease="lease",
337
+ >>> note="note",
338
+ >>> rekey_to="REKEYTOADDRESS",
339
+ >>> first_valid_round=1000,
340
+ >>> validity_window=10,
341
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
342
+ >>> static_fee=AlgoAmount(micro_algo=1000),
343
+ >>> max_fee=AlgoAmount(micro_algo=3000),
344
+ >>> signer=transactionSigner
345
+ >>> ), send_params=SendParams(
346
+ >>> max_rounds_to_wait_for_confirmation=5,
347
+ >>> suppress_log=True,
348
+ >>> ))
295
349
  """
296
350
  return self._send(
297
351
  lambda c: c.add_payment,
@@ -309,6 +363,47 @@ class AlgorandClientTransactionSender:
309
363
  :param params: Asset creation parameters
310
364
  :param send_params: Send parameters
311
365
  :return: Result containing the new asset ID
366
+
367
+ :example:
368
+ >>> result = algorand.send.asset_create(AssetCreateParams(
369
+ >>> sender="SENDERADDRESS",
370
+ >>> asset_name="ASSETNAME",
371
+ >>> unit_name="UNITNAME",
372
+ >>> total=1000,
373
+ >>> ))
374
+
375
+ >>> # Advanced example
376
+ >>> result = algorand.send.asset_create(AssetCreateParams(
377
+ >>> sender="CREATORADDRESS",
378
+ >>> total=100,
379
+ >>> decimals=2,
380
+ >>> asset_name="asset",
381
+ >>> unit_name="unit",
382
+ >>> url="url",
383
+ >>> metadata_hash="metadataHash",
384
+ >>> default_frozen=False,
385
+ >>> manager="MANAGERADDRESS",
386
+ >>> reserve="RESERVEADDRESS",
387
+ >>> freeze="FREEZEADDRESS",
388
+ >>> clawback="CLAWBACKADDRESS",
389
+ >>> lease="lease",
390
+ >>> note="note",
391
+ >>> # You wouldn't normally set this field
392
+ >>> first_valid_round=1000,
393
+ >>> validity_window=10,
394
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
395
+ >>> static_fee=AlgoAmount(micro_algo=1000),
396
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
397
+ >>> # already specified, but here for completeness
398
+ >>> max_fee=AlgoAmount(micro_algo=3000),
399
+ >>> # Signer only needed if you want to provide one,
400
+ >>> # generally you'd register it with AlgorandClient
401
+ >>> # against the sender and not need to pass it in
402
+ >>> signer=transactionSigner
403
+ >>> ), send_params=SendParams(
404
+ >>> max_rounds_to_wait_for_confirmation=5,
405
+ >>> suppress_log=True,
406
+ >>> ))
312
407
  """
313
408
  result = self._send(
314
409
  lambda c: c.add_asset_create,
@@ -334,6 +429,33 @@ class AlgorandClientTransactionSender:
334
429
  :param params: Asset configuration parameters
335
430
  :param send_params: Send parameters
336
431
  :return: Result of the configuration transaction
432
+
433
+ :example:
434
+ >>> result = algorand.send.asset_config(AssetConfigParams(
435
+ >>> sender="MANAGERADDRESS",
436
+ >>> asset_id=123456,
437
+ >>> manager="MANAGERADDRESS",
438
+ >>> reserve="RESERVEADDRESS",
439
+ >>> freeze="FREEZEADDRESS",
440
+ >>> clawback="CLAWBACKADDRESS",
441
+ >>> lease="lease",
442
+ >>> note="note",
443
+ >>> # You wouldn't normally set this field
444
+ >>> first_valid_round=1000,
445
+ >>> validity_window=10,
446
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
447
+ >>> static_fee=AlgoAmount(micro_algo=1000),
448
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
449
+ >>> # already specified, but here for completeness
450
+ >>> max_fee=AlgoAmount(micro_algo=3000),
451
+ >>> # Signer only needed if you want to provide one,
452
+ >>> # generally you'd register it with AlgorandClient
453
+ >>> # against the sender and not need to pass it in
454
+ >>> signer=transactionSigner
455
+ >>> ), send_params=SendParams(
456
+ >>> max_rounds_to_wait_for_confirmation=5,
457
+ >>> suppress_log=True,
458
+ >>> ))
337
459
  """
338
460
  return self._send(
339
461
  lambda c: c.add_asset_config,
@@ -350,6 +472,39 @@ class AlgorandClientTransactionSender:
350
472
  :param params: Asset freeze parameters
351
473
  :param send_params: Send parameters
352
474
  :return: Result of the freeze transaction
475
+
476
+ :example:
477
+ >>> result = algorand.send.asset_freeze(AssetFreezeParams(
478
+ >>> sender="MANAGERADDRESS",
479
+ >>> asset_id=123456,
480
+ >>> account="ACCOUNTADDRESS",
481
+ >>> frozen=True,
482
+ >>> ))
483
+
484
+ >>> # Advanced example
485
+ >>> result = algorand.send.asset_freeze(AssetFreezeParams(
486
+ >>> sender="MANAGERADDRESS",
487
+ >>> asset_id=123456,
488
+ >>> account="ACCOUNTADDRESS",
489
+ >>> frozen=True,
490
+ >>> lease="lease",
491
+ >>> note="note",
492
+ >>> # You wouldn't normally set this field
493
+ >>> first_valid_round=1000,
494
+ >>> validity_window=10,
495
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
496
+ >>> static_fee=AlgoAmount(micro_algo=1000),
497
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
498
+ >>> # already specified, but here for completeness
499
+ >>> max_fee=AlgoAmount(micro_algo=3000),
500
+ >>> # Signer only needed if you want to provide one,
501
+ >>> # generally you'd register it with AlgorandClient
502
+ >>> # against the sender and not need to pass it in
503
+ >>> signer=transactionSigner
504
+ >>> ), send_params=SendParams(
505
+ >>> max_rounds_to_wait_for_confirmation=5,
506
+ >>> suppress_log=True,
507
+ >>> ))
353
508
  """
354
509
  return self._send(
355
510
  lambda c: c.add_asset_freeze,
@@ -366,6 +521,35 @@ class AlgorandClientTransactionSender:
366
521
  :param params: Asset destruction parameters
367
522
  :param send_params: Send parameters
368
523
  :return: Result of the destroy transaction
524
+
525
+ :example:
526
+ >>> result = algorand.send.asset_destroy(AssetDestroyParams(
527
+ >>> sender="MANAGERADDRESS",
528
+ >>> asset_id=123456,
529
+ >>> ))
530
+
531
+ >>> # Advanced example
532
+ >>> result = algorand.send.asset_destroy(AssetDestroyParams(
533
+ >>> sender="MANAGERADDRESS",
534
+ >>> asset_id=123456,
535
+ >>> lease="lease",
536
+ >>> note="note",
537
+ >>> # You wouldn't normally set this field
538
+ >>> first_valid_round=1000,
539
+ >>> validity_window=10,
540
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
541
+ >>> static_fee=AlgoAmount(micro_algo=1000),
542
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
543
+ >>> # already specified, but here for completeness
544
+ >>> max_fee=AlgoAmount(micro_algo=3000),
545
+ >>> # Signer only needed if you want to provide one,
546
+ >>> # generally you'd register it with AlgorandClient
547
+ >>> # against the sender and not need to pass it in
548
+ >>> signer=transactionSigner
549
+ >>> ), send_params=SendParams(
550
+ >>> max_rounds_to_wait_for_confirmation=5,
551
+ >>> suppress_log=True,
552
+ >>> ))
369
553
  """
370
554
  return self._send(
371
555
  lambda c: c.add_asset_destroy,
@@ -382,6 +566,42 @@ class AlgorandClientTransactionSender:
382
566
  :param params: Asset transfer parameters
383
567
  :param send_params: Send parameters
384
568
  :return: Result of the transfer transaction
569
+
570
+ :example:
571
+ >>> result = algorand.send.asset_transfer(AssetTransferParams(
572
+ >>> sender="HOLDERADDRESS",
573
+ >>> asset_id=123456,
574
+ >>> amount=1,
575
+ >>> receiver="RECEIVERADDRESS",
576
+ >>> ))
577
+
578
+ >>> # Advanced example (with clawback)
579
+ >>> result = algorand.send.asset_transfer(AssetTransferParams(
580
+ >>> sender="CLAWBACKADDRESS",
581
+ >>> asset_id=123456,
582
+ >>> amount=1,
583
+ >>> receiver="RECEIVERADDRESS",
584
+ >>> clawback_target="HOLDERADDRESS",
585
+ >>> # This field needs to be used with caution
586
+ >>> close_asset_to="ADDRESSTOCLOSETO",
587
+ >>> lease="lease",
588
+ >>> note="note",
589
+ >>> # You wouldn't normally set this field
590
+ >>> first_valid_round=1000,
591
+ >>> validity_window=10,
592
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
593
+ >>> static_fee=AlgoAmount(micro_algo=1000),
594
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
595
+ >>> # already specified, but here for completeness
596
+ >>> max_fee=AlgoAmount(micro_algo=3000),
597
+ >>> # Signer only needed if you want to provide one,
598
+ >>> # generally you'd register it with AlgorandClient
599
+ >>> # against the sender and not need to pass it in
600
+ >>> signer=transactionSigner
601
+ >>> ), send_params=SendParams(
602
+ >>> max_rounds_to_wait_for_confirmation=5,
603
+ >>> suppress_log=True,
604
+ >>> ))
385
605
  """
386
606
  return self._send(
387
607
  lambda c: c.add_asset_transfer,
@@ -399,6 +619,35 @@ class AlgorandClientTransactionSender:
399
619
  :param params: Asset opt-in parameters
400
620
  :param send_params: Send parameters
401
621
  :return: Result of the opt-in transaction
622
+
623
+ :example:
624
+ >>> result = algorand.send.asset_opt_in(AssetOptInParams(
625
+ >>> sender="SENDERADDRESS",
626
+ >>> asset_id=123456,
627
+ >>> ))
628
+
629
+ >>> # Advanced example
630
+ >>> result = algorand.send.asset_opt_in(AssetOptInParams(
631
+ >>> sender="SENDERADDRESS",
632
+ >>> asset_id=123456,
633
+ >>> lease="lease",
634
+ >>> note="note",
635
+ >>> # You wouldn't normally set this field
636
+ >>> first_valid_round=1000,
637
+ >>> validity_window=10,
638
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
639
+ >>> static_fee=AlgoAmount(micro_algo=1000),
640
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
641
+ >>> # already specified, but here for completeness
642
+ >>> max_fee=AlgoAmount(micro_algo=3000),
643
+ >>> # Signer only needed if you want to provide one,
644
+ >>> # generally you'd register it with AlgorandClient
645
+ >>> # against the sender and not need to pass it in
646
+ >>> signer=transactionSigner
647
+ >>> ), send_params=SendParams(
648
+ >>> max_rounds_to_wait_for_confirmation=5,
649
+ >>> suppress_log=True,
650
+ >>> ))
402
651
  """
403
652
  return self._send(
404
653
  lambda c: c.add_asset_opt_in,
@@ -422,6 +671,39 @@ class AlgorandClientTransactionSender:
422
671
  :param ensure_zero_balance: Check if account has zero balance before opt-out, defaults to True
423
672
  :raises ValueError: If account has non-zero balance or is not opted in
424
673
  :return: Result of the opt-out transaction
674
+
675
+ :example:
676
+ >>> result = algorand.send.asset_opt_out(AssetOptOutParams(
677
+ >>> sender="SENDERADDRESS",
678
+ >>> creator="CREATORADDRESS",
679
+ >>> asset_id=123456,
680
+ >>> ensure_zero_balance=True,
681
+ >>> ))
682
+
683
+ >>> # Advanced example
684
+ >>> result = algorand.send.asset_opt_out(AssetOptOutParams(
685
+ >>> sender="SENDERADDRESS",
686
+ >>> asset_id=123456,
687
+ >>> creator="CREATORADDRESS",
688
+ >>> ensure_zero_balance=True,
689
+ >>> lease="lease",
690
+ >>> note="note",
691
+ >>> # You wouldn't normally set this field
692
+ >>> first_valid_round=1000,
693
+ >>> validity_window=10,
694
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
695
+ >>> static_fee=AlgoAmount(micro_algo=1000),
696
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
697
+ >>> # already specified, but here for completeness
698
+ >>> max_fee=AlgoAmount(micro_algo=3000),
699
+ >>> # Signer only needed if you want to provide one,
700
+ >>> # generally you'd register it with AlgorandClient
701
+ >>> # against the sender and not need to pass it in
702
+ >>> signer=transactionSigner
703
+ >>> ), send_params=SendParams(
704
+ >>> max_rounds_to_wait_for_confirmation=5,
705
+ >>> suppress_log=True,
706
+ >>> ))
425
707
  """
426
708
  if ensure_zero_balance:
427
709
  try:
@@ -461,6 +743,55 @@ class AlgorandClientTransactionSender:
461
743
  :param params: Application creation parameters
462
744
  :param send_params: Send parameters
463
745
  :return: Result containing the new application ID and address
746
+
747
+ :example:
748
+ >>> result = algorand.send.app_create(AppCreateParams(
749
+ >>> sender="CREATORADDRESS",
750
+ >>> approval_program="TEALCODE",
751
+ >>> clear_state_program="TEALCODE",
752
+ >>> ))
753
+
754
+ >>> # Advanced example
755
+ >>> result = algorand.send.app_create(AppCreateParams(
756
+ >>> sender="CREATORADDRESS",
757
+ >>> approval_program="TEALCODE",
758
+ >>> clear_state_program="TEALCODE",
759
+ >>> ))
760
+ >>> # algorand.send.appCreate(AppCreateParams(
761
+ >>> # sender='CREATORADDRESS',
762
+ >>> # approval_program="TEALCODE",
763
+ >>> # clear_state_program="TEALCODE",
764
+ >>> # schema={
765
+ >>> # "global_ints": 1,
766
+ >>> # "global_byte_slices": 2,
767
+ >>> # "local_ints": 3,
768
+ >>> # "local_byte_slices": 4
769
+ >>> # },
770
+ >>> # extra_program_pages: 1,
771
+ >>> # on_complete: algosdk.transaction.OnComplete.OptInOC,
772
+ >>> # args: [b'some_bytes']
773
+ >>> # account_references: ["ACCOUNT_1"]
774
+ >>> # app_references: [123, 1234]
775
+ >>> # asset_references: [12345]
776
+ >>> # box_references: ["box1", {app_id: 1234, name: "box2"}]
777
+ >>> # lease: 'lease',
778
+ >>> # note: 'note',
779
+ >>> # # You wouldn't normally set this field
780
+ >>> # first_valid_round: 1000,
781
+ >>> # validity_window: 10,
782
+ >>> # extra_fee: AlgoAmount(micro_algo=1000),
783
+ >>> # static_fee: AlgoAmount(micro_algo=1000),
784
+ >>> # # Max fee doesn't make sense with extraFee AND staticFee
785
+ >>> # # already specified, but here for completeness
786
+ >>> # max_fee: AlgoAmount(micro_algo=3000),
787
+ >>> # # Signer only needed if you want to provide one,
788
+ >>> # # generally you'd register it with AlgorandClient
789
+ >>> # # against the sender and not need to pass it in
790
+ >>> # signer: transactionSigner
791
+ >>> #}, send_params=SendParams(
792
+ >>> # max_rounds_to_wait_for_confirmation=5,
793
+ >>> # suppress_log=True,
794
+ >>> #))
464
795
  """
465
796
  return self._send_app_create_call(lambda c: c.add_app_create)(params, send_params)
466
797
 
@@ -472,6 +803,43 @@ class AlgorandClientTransactionSender:
472
803
  :param params: Application update parameters
473
804
  :param send_params: Send parameters
474
805
  :return: Result containing the compiled programs
806
+
807
+ :example:
808
+ >>> # Basic example
809
+ >>> algorand.send.app_update(AppUpdateParams(
810
+ >>> sender="CREATORADDRESS",
811
+ >>> approval_program="TEALCODE",
812
+ >>> clear_state_program="TEALCODE",
813
+ >>> ))
814
+ >>> # Advanced example
815
+ >>> algorand.send.app_update(AppUpdateParams(
816
+ >>> sender="CREATORADDRESS",
817
+ >>> approval_program="TEALCODE",
818
+ >>> clear_state_program="TEALCODE",
819
+ >>> on_complete=OnComplete.UpdateApplicationOC,
820
+ >>> args=[b'some_bytes'],
821
+ >>> account_references=["ACCOUNT_1"],
822
+ >>> app_references=[123, 1234],
823
+ >>> asset_references=[12345],
824
+ >>> box_references=[...],
825
+ >>> lease="lease",
826
+ >>> note="note",
827
+ >>> # You wouldn't normally set this field
828
+ >>> first_valid_round=1000,
829
+ >>> validity_window=10,
830
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
831
+ >>> static_fee=AlgoAmount(micro_algo=1000),
832
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
833
+ >>> # already specified, but here for completeness
834
+ >>> max_fee=AlgoAmount(micro_algo=3000),
835
+ >>> # Signer only needed if you want to provide one,
836
+ >>> # generally you'd register it with AlgorandClient
837
+ >>> # against the sender and not need to pass it in
838
+ >>> signer=transactionSigner
839
+ >>> ), send_params=SendParams(
840
+ >>> max_rounds_to_wait_for_confirmation=5,
841
+ >>> suppress_log=True,
842
+ >>> ))
475
843
  """
476
844
  return self._send_app_update_call(lambda c: c.add_app_update)(params, send_params)
477
845
 
@@ -483,6 +851,40 @@ class AlgorandClientTransactionSender:
483
851
  :param params: Application deletion parameters
484
852
  :param send_params: Send parameters
485
853
  :return: Result of the deletion transaction
854
+
855
+ :example:
856
+ >>> # Basic example
857
+ >>> algorand.send.app_delete(AppDeleteParams(
858
+ >>> sender="CREATORADDRESS",
859
+ >>> app_id=123456,
860
+ >>> ))
861
+ >>> # Advanced example
862
+ >>> algorand.send.app_delete(AppDeleteParams(
863
+ >>> sender="CREATORADDRESS",
864
+ >>> on_complete=OnComplete.DeleteApplicationOC,
865
+ >>> args=[b'some_bytes'],
866
+ >>> account_references=["ACCOUNT_1"],
867
+ >>> app_references=[123, 1234],
868
+ >>> asset_references=[12345],
869
+ >>> box_references=[...],
870
+ >>> lease="lease",
871
+ >>> note="note",
872
+ >>> # You wouldn't normally set this field
873
+ >>> first_valid_round=1000,
874
+ >>> validity_window=10,
875
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
876
+ >>> static_fee=AlgoAmount(micro_algo=1000),
877
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
878
+ >>> # already specified, but here for completeness
879
+ >>> max_fee=AlgoAmount(micro_algo=3000),
880
+ >>> # Signer only needed if you want to provide one,
881
+ >>> # generally you'd register it with AlgorandClient
882
+ >>> # against the sender and not need to pass it in
883
+ >>> signer=transactionSigner,
884
+ >>> ), send_params=SendParams(
885
+ >>> max_rounds_to_wait_for_confirmation=5,
886
+ >>> suppress_log=True,
887
+ >>> ))
486
888
  """
487
889
  return self._send_app_call(lambda c: c.add_app_delete)(params, send_params)
488
890
 
@@ -494,6 +896,40 @@ class AlgorandClientTransactionSender:
494
896
  :param params: Application call parameters
495
897
  :param send_params: Send parameters
496
898
  :return: Result containing any ABI return value
899
+
900
+ :example:
901
+ >>> # Basic example
902
+ >>> algorand.send.app_call(AppCallParams(
903
+ >>> sender="CREATORADDRESS",
904
+ >>> app_id=123456,
905
+ >>> ))
906
+ >>> # Advanced example
907
+ >>> algorand.send.app_call(AppCallParams(
908
+ >>> sender="CREATORADDRESS",
909
+ >>> on_complete=OnComplete.OptInOC,
910
+ >>> args=[b'some_bytes'],
911
+ >>> account_references=["ACCOUNT_1"],
912
+ >>> app_references=[123, 1234],
913
+ >>> asset_references=[12345],
914
+ >>> box_references=[...],
915
+ >>> lease="lease",
916
+ >>> note="note",
917
+ >>> # You wouldn't normally set this field
918
+ >>> first_valid_round=1000,
919
+ >>> validity_window=10,
920
+ >>> extra_fee=AlgoAmount(micro_algo=1000),
921
+ >>> static_fee=AlgoAmount(micro_algo=1000),
922
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
923
+ >>> # already specified, but here for completeness
924
+ >>> max_fee=AlgoAmount(micro_algo=3000),
925
+ >>> # Signer only needed if you want to provide one,
926
+ >>> # generally you'd register it with AlgorandClient
927
+ >>> # against the sender and not need to pass it in
928
+ >>> signer=transactionSigner,
929
+ >>> ), send_params=SendParams(
930
+ >>> max_rounds_to_wait_for_confirmation=5,
931
+ >>> suppress_log=True,
932
+ >>> ))
497
933
  """
498
934
  return self._send_app_call(lambda c: c.add_app_call)(params, send_params)
499
935
 
@@ -505,6 +941,67 @@ class AlgorandClientTransactionSender:
505
941
  :param params: Method call parameters for application creation
506
942
  :param send_params: Send parameters
507
943
  :return: Result containing the new application ID and address
944
+
945
+ :example:
946
+ >>> # Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
947
+ >>> #
948
+ >>> # @param params The parameters for the app creation transaction
949
+ >>> # Basic example
950
+ >>> method = algorand.abi.Method(
951
+ >>> name='method',
952
+ >>> args=[b'arg1'],
953
+ >>> returns='string'
954
+ >>> )
955
+ >>> result = algorand.send.app_create_method_call({ sender: 'CREATORADDRESS',
956
+ >>> approval_program: 'TEALCODE',
957
+ >>> clear_state_program: 'TEALCODE',
958
+ >>> method: method,
959
+ >>> args: ["arg1_value"] })
960
+ >>> created_app_id = result.app_id
961
+ >>> ...
962
+ >>> # Advanced example
963
+ >>> method = algorand.abi.Method(
964
+ >>> name='method',
965
+ >>> args=[b'arg1'],
966
+ >>> returns='string'
967
+ >>> )
968
+ >>> result = algorand.send.app_create_method_call({
969
+ >>> sender: 'CREATORADDRESS',
970
+ >>> method: method,
971
+ >>> args: ["arg1_value"],
972
+ >>> approval_program: "TEALCODE",
973
+ >>> clear_state_program: "TEALCODE",
974
+ >>> schema: {
975
+ >>> "global_ints": 1,
976
+ >>> "global_byte_slices": 2,
977
+ >>> "local_ints": 3,
978
+ >>> "local_byte_slices": 4
979
+ >>> },
980
+ >>> extra_program_pages: 1,
981
+ >>> on_complete: algosdk.transaction.OnComplete.OptInOC,
982
+ >>> args: [new Uint8Array(1, 2, 3, 4)],
983
+ >>> account_references: ["ACCOUNT_1"],
984
+ >>> app_references: [123, 1234],
985
+ >>> asset_references: [12345],
986
+ >>> box_references: [...],
987
+ >>> lease: 'lease',
988
+ >>> note: 'note',
989
+ >>> # You wouldn't normally set this field
990
+ >>> first_valid_round: 1000,
991
+ >>> validity_window: 10,
992
+ >>> extra_fee: AlgoAmount(micro_algo=1000),
993
+ >>> static_fee: AlgoAmount(micro_algo=1000),
994
+ >>> # Max fee doesn't make sense with extraFee AND staticFee
995
+ >>> # already specified, but here for completeness
996
+ >>> max_fee: AlgoAmount(micro_algo=3000),
997
+ >>> # Signer only needed if you want to provide one,
998
+ >>> # generally you'd register it with AlgorandClient
999
+ >>> # against the sender and not need to pass it in
1000
+ >>> signer: transactionSigner,
1001
+ >>> }, send_params=SendParams(
1002
+ >>> max_rounds_to_wait_for_confirmation=5,
1003
+ >>> suppress_log=True,
1004
+ >>> ))
508
1005
  """
509
1006
  return self._send_app_create_call(lambda c: c.add_app_create_method_call)(params, send_params)
510
1007
 
@@ -516,6 +1013,44 @@ class AlgorandClientTransactionSender:
516
1013
  :param params: Method call parameters for application update
517
1014
  :param send_params: Send parameters
518
1015
  :return: Result containing the compiled programs
1016
+
1017
+ :example:
1018
+ # Basic example:
1019
+ >>> method = algorand.abi.Method(
1020
+ ... name="updateMethod",
1021
+ ... args=[{"type": "string", "name": "arg1"}],
1022
+ ... returns="string"
1023
+ ... )
1024
+ >>> params = AppUpdateMethodCallParams(
1025
+ ... sender="CREATORADDRESS",
1026
+ ... app_id=123,
1027
+ ... method=method,
1028
+ ... args=["new_value"],
1029
+ ... approval_program="TEALCODE",
1030
+ ... clear_state_program="TEALCODE"
1031
+ ... )
1032
+ >>> result = algorand.send.app_update_method_call(params)
1033
+ >>> print(result.compiled_approval, result.compiled_clear)
1034
+
1035
+ # Advanced example:
1036
+ >>> method = algorand.abi.Method(
1037
+ ... name="updateMethod",
1038
+ ... args=[{"type": "string", "name": "arg1"}, {"type": "uint64", "name": "arg2"}],
1039
+ ... returns="string"
1040
+ ... )
1041
+ >>> params = AppUpdateMethodCallParams(
1042
+ ... sender="CREATORADDRESS",
1043
+ ... app_id=456,
1044
+ ... method=method,
1045
+ ... args=["new_value", 42],
1046
+ ... approval_program="TEALCODE_ADVANCED",
1047
+ ... clear_state_program="TEALCLEAR_ADVANCED",
1048
+ ... account_references=["ACCOUNT1", "ACCOUNT2"],
1049
+ ... app_references=[789],
1050
+ ... asset_references=[101112]
1051
+ ... )
1052
+ >>> result = algorand.send.app_update_method_call(params)
1053
+ >>> print(result.compiled_approval, result.compiled_clear)
519
1054
  """
520
1055
  return self._send_app_update_call(lambda c: c.add_app_update_method_call)(params, send_params)
521
1056
 
@@ -527,6 +1062,38 @@ class AlgorandClientTransactionSender:
527
1062
  :param params: Method call parameters for application deletion
528
1063
  :param send_params: Send parameters
529
1064
  :return: Result of the deletion transaction
1065
+
1066
+ :example:
1067
+ # Basic example:
1068
+ >>> method = algorand.abi.Method(
1069
+ ... name="deleteMethod",
1070
+ ... args=[],
1071
+ ... returns="void"
1072
+ ... )
1073
+ >>> params = AppDeleteMethodCallParams(
1074
+ ... sender="CREATORADDRESS",
1075
+ ... app_id=123,
1076
+ ... method=method
1077
+ ... )
1078
+ >>> result = algorand.send.app_delete_method_call(params)
1079
+ >>> print(result.tx_id)
1080
+
1081
+ # Advanced example:
1082
+ >>> method = algorand.abi.Method(
1083
+ ... name="deleteMethod",
1084
+ ... args=[{"type": "uint64", "name": "confirmation"}],
1085
+ ... returns="void"
1086
+ ... )
1087
+ >>> params = AppDeleteMethodCallParams(
1088
+ ... sender="CREATORADDRESS",
1089
+ ... app_id=123,
1090
+ ... method=method,
1091
+ ... args=[1],
1092
+ ... account_references=["ACCOUNT1"],
1093
+ ... app_references=[456]
1094
+ ... )
1095
+ >>> result = algorand.send.app_delete_method_call(params)
1096
+ >>> print(result.tx_id)
530
1097
  """
531
1098
  return self._send_app_call(lambda c: c.add_app_delete_method_call)(params, send_params)
532
1099
 
@@ -538,6 +1105,40 @@ class AlgorandClientTransactionSender:
538
1105
  :param params: Method call parameters
539
1106
  :param send_params: Send parameters
540
1107
  :return: Result containing any ABI return value
1108
+
1109
+ :example:
1110
+ # Basic example:
1111
+ >>> method = algorand.abi.Method(
1112
+ ... name="callMethod",
1113
+ ... args=[{"type": "uint64", "name": "arg1"}],
1114
+ ... returns="uint64"
1115
+ ... )
1116
+ >>> params = AppCallMethodCallParams(
1117
+ ... sender="CALLERADDRESS",
1118
+ ... app_id=123,
1119
+ ... method=method,
1120
+ ... args=[12345]
1121
+ ... )
1122
+ >>> result = algorand.send.app_call_method_call(params)
1123
+ >>> print(result.abi_return)
1124
+
1125
+ # Advanced example:
1126
+ >>> method = algorand.abi.Method(
1127
+ ... name="callMethod",
1128
+ ... args=[{"type": "uint64", "name": "arg1"}, {"type": "string", "name": "arg2"}],
1129
+ ... returns="uint64"
1130
+ ... )
1131
+ >>> params = AppCallMethodCallParams(
1132
+ ... sender="CALLERADDRESS",
1133
+ ... app_id=123,
1134
+ ... method=method,
1135
+ ... args=[12345, "extra"],
1136
+ ... account_references=["ACCOUNT1"],
1137
+ ... asset_references=[101112],
1138
+ ... app_references=[789]
1139
+ ... )
1140
+ >>> result = algorand.send.app_call_method_call(params)
1141
+ >>> print(result.abi_return)
541
1142
  """
542
1143
  return self._send_app_call(lambda c: c.add_app_call_method_call)(params, send_params)
543
1144
 
@@ -549,6 +1150,32 @@ class AlgorandClientTransactionSender:
549
1150
  :param params: Key registration parameters
550
1151
  :param send_params: Send parameters
551
1152
  :return: Result of the registration transaction
1153
+
1154
+ :example:
1155
+ # Basic example:
1156
+ >>> params = OnlineKeyRegistrationParams(
1157
+ ... sender="ACCOUNTADDRESS",
1158
+ ... vote_key="VOTEKEY",
1159
+ ... selection_key="SELECTIONKEY",
1160
+ ... vote_first=1000,
1161
+ ... vote_last=2000,
1162
+ ... vote_key_dilution=10
1163
+ ... )
1164
+ >>> result = algorand.send.online_key_registration(params)
1165
+ >>> print(result.tx_id)
1166
+
1167
+ # Advanced example:
1168
+ >>> params = OnlineKeyRegistrationParams(
1169
+ ... sender="ACCOUNTADDRESS",
1170
+ ... vote_key="VOTEKEY",
1171
+ ... selection_key="SELECTIONKEY",
1172
+ ... vote_first=1000,
1173
+ ... vote_last=2100,
1174
+ ... vote_key_dilution=10,
1175
+ ... state_proof_key=b'\x01' * 64
1176
+ ... )
1177
+ >>> result = algorand.send.online_key_registration(params)
1178
+ >>> print(result.tx_id)
552
1179
  """
553
1180
  return self._send(
554
1181
  lambda c: c.add_online_key_registration,
@@ -565,6 +1192,24 @@ class AlgorandClientTransactionSender:
565
1192
  :param params: Key registration parameters
566
1193
  :param send_params: Send parameters
567
1194
  :return: Result of the registration transaction
1195
+
1196
+ :example:
1197
+ # Basic example:
1198
+ >>> params = OfflineKeyRegistrationParams(
1199
+ ... sender="ACCOUNTADDRESS",
1200
+ ... prevent_account_from_ever_participating_again=True
1201
+ ... )
1202
+ >>> result = algorand.send.offline_key_registration(params)
1203
+ >>> print(result.tx_id)
1204
+
1205
+ # Advanced example:
1206
+ >>> params = OfflineKeyRegistrationParams(
1207
+ ... sender="ACCOUNTADDRESS",
1208
+ ... prevent_account_from_ever_participating_again=True,
1209
+ ... note=b'Offline registration'
1210
+ ... )
1211
+ >>> result = algorand.send.offline_key_registration(params)
1212
+ >>> print(result.tx_id)
568
1213
  """
569
1214
  return self._send(
570
1215
  lambda c: c.add_offline_key_registration,