@@ -280,6 +280,27 @@ methods for calling application methods, managing state, and handling transactio
280
280
281
281
* ** Parameters:**
282
282
** params** – Parameters for creating the app client
283
+ * ** Example:**
284
+ ``` pycon
285
+ >>> params = AppClientParams(
286
+ ... app_spec=Arc56Contract.from_json(app_spec_json),
287
+ ... algorand=algorand,
288
+ ... app_id=1234567890,
289
+ ... app_name="My App",
290
+ ... default_sender="SENDERADDRESS",
291
+ ... default_signer=TransactionSigner(
292
+ ... account="SIGNERACCOUNT",
293
+ ... private_key="SIGNERPRIVATEKEY",
294
+ ... ),
295
+ ... approval_source_map=SourceMap(
296
+ ... source="APPROVALSOURCE",
297
+ ... ),
298
+ ... clear_source_map=SourceMap(
299
+ ... source="CLEARSOURCE",
300
+ ... ),
301
+ ... )
302
+ >>> client = AppClient(params)
303
+ ```
283
304
284
305
#### * property* algorand * : [ algokit_utils.algorand.AlgorandClient] ( ../../algorand/index.md#algokit_utils.algorand.AlgorandClient ) *
285
306
@@ -329,6 +350,20 @@ Get the method parameters builder.
329
350
330
351
* ** Returns:**
331
352
The method parameters builder for this application
353
+ * ** Example:**
354
+ ``` pycon
355
+ >>> # Create a transaction in the future using Algorand Client
356
+ >>> my_method_call = app_client.params.call(AppClientMethodCallParams(
357
+ method='my_method',
358
+ args=[123, 'hello']))
359
+ >>> # ...
360
+ >>> await algorand.send.AppMethodCall(my_method_call)
361
+ >>> # Define a nested transaction as an ABI argument
362
+ >>> my_method_call = app_client.params.call(AppClientMethodCallParams(
363
+ method='my_method',
364
+ args=[123, 'hello']))
365
+ >>> app_client.send.call(AppClientMethodCallParams(method='my_method2', args=[my_method_call]))
366
+ ```
332
367
333
368
#### * property* send * : \_ TransactionSender*
334
369
@@ -349,11 +384,16 @@ Get the transaction creator.
349
384
Normalize an application specification to ARC-56 format.
350
385
351
386
* ** Parameters:**
352
- ** app_spec** – The application specification to normalize
387
+ ** app_spec** – The application specification to normalize. Can be raw arc32 or arc56 json,
388
+ or an Arc32Contract or Arc56Contract instance
353
389
* ** Returns:**
354
390
The normalized ARC-56 contract specification
355
391
* ** Raises:**
356
392
** ValueError** – If the app spec format is invalid
393
+ * ** Example:**
394
+ ``` pycon
395
+ >>> spec = AppClient.normalise_app_spec(app_spec_json)
396
+ ```
357
397
358
398
#### * static* from_network(app_spec: [ algokit_utils.applications.app_spec.arc56.Arc56Contract] ( ../app_spec/arc56/index.md#algokit_utils.applications.app_spec.arc56.Arc56Contract ) | [ algokit_utils.applications.app_spec.arc32.Arc32Contract] ( ../app_spec/arc32/index.md#algokit_utils.applications.app_spec.arc32.Arc32Contract ) | str, algorand: [ algokit_utils.algorand.AlgorandClient] ( ../../algorand/index.md#algokit_utils.algorand.AlgorandClient ) , app_name: str | None = None, default_sender: str | None = None, default_signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None, approval_source_map: algosdk.source_map.SourceMap | None = None, clear_source_map: algosdk.source_map.SourceMap | None = None) → [ AppClient] ( #algokit_utils.applications.app_client.AppClient )
359
399
@@ -371,6 +411,25 @@ Create an AppClient instance from network information.
371
411
A new AppClient instance
372
412
* ** Raises:**
373
413
** Exception** – If no app ID is found for the network
414
+ * ** Example:**
415
+ ``` pycon
416
+ >>> client = AppClient.from_network(
417
+ ... app_spec=Arc56Contract.from_json(app_spec_json),
418
+ ... algorand=algorand,
419
+ ... app_name="My App",
420
+ ... default_sender="SENDERADDRESS",
421
+ ... default_signer=TransactionSigner(
422
+ ... account="SIGNERACCOUNT",
423
+ ... private_key="SIGNERPRIVATEKEY",
424
+ ... ),
425
+ ... approval_source_map=SourceMap(
426
+ ... source="APPROVALSOURCE",
427
+ ... ),
428
+ ... clear_source_map=SourceMap(
429
+ ... source="CLEARSOURCE",
430
+ ... ),
431
+ ... )
432
+ ```
374
433
375
434
#### * static* from_creator_and_name(creator_address: str, app_name: str, app_spec: [ algokit_utils.applications.app_spec.arc56.Arc56Contract] ( ../app_spec/arc56/index.md#algokit_utils.applications.app_spec.arc56.Arc56Contract ) | [ algokit_utils.applications.app_spec.arc32.Arc32Contract] ( ../app_spec/arc32/index.md#algokit_utils.applications.app_spec.arc32.Arc32Contract ) | str, algorand: [ algokit_utils.algorand.AlgorandClient] ( ../../algorand/index.md#algokit_utils.algorand.AlgorandClient ) , default_sender: str | None = None, default_signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None, approval_source_map: algosdk.source_map.SourceMap | None = None, clear_source_map: algosdk.source_map.SourceMap | None = None, ignore_cache: bool | None = None, app_lookup_cache: [ algokit_utils.applications.app_deployer.ApplicationLookup] ( ../app_deployer/index.md#algokit_utils.applications.app_deployer.ApplicationLookup ) | None = None) → [ AppClient] ( #algokit_utils.applications.app_client.AppClient )
376
435
@@ -391,6 +450,15 @@ Create an AppClient instance from creator address and application name.
391
450
A new AppClient instance
392
451
* ** Raises:**
393
452
** ValueError** – If the app is not found for the creator and name
453
+ * ** Example:**
454
+ ``` pycon
455
+ >>> client = AppClient.from_creator_and_name(
456
+ ... creator_address="CREATORADDRESS",
457
+ ... app_name="APPNAME",
458
+ ... app_spec=Arc56Contract.from_json(app_spec_json),
459
+ ... algorand=algorand,
460
+ ... )
461
+ ```
394
462
395
463
#### * static* compile(app_spec: [ algokit_utils.applications.app_spec.arc56.Arc56Contract] ( ../app_spec/arc56/index.md#algokit_utils.applications.app_spec.arc56.Arc56Contract ) , app_manager: [ algokit_utils.applications.app_manager.AppManager] ( ../app_manager/index.md#algokit_utils.applications.app_manager.AppManager ) , compilation_params: [ AppClientCompilationParams] ( #algokit_utils.applications.app_client.AppClientCompilationParams ) | None = None) → [ AppClientCompilationResult] ( #algokit_utils.applications.app_client.AppClientCompilationResult )
396
464
@@ -425,7 +493,12 @@ Create a cloned AppClient instance with optionally overridden parameters.
425
493
* ** approval_source_map** – Optional new approval source map
426
494
* ** clear_source_map** – Optional new clear source map
427
495
* ** Returns:**
428
- A new AppClient instance with the specified parameters
496
+ A new AppClient instance
497
+ * ** Example:**
498
+ ``` pycon
499
+ >>> client = AppClient(params)
500
+ >>> cloned_client = client.clone(app_name="Cloned App", default_sender="NEW_SENDER")
501
+ ```
429
502
430
503
#### export_source_maps() → [ algokit_utils.models.application.AppSourceMaps] ( ../../models/application/index.md#algokit_utils.models.application.AppSourceMaps )
431
504
@@ -460,13 +533,21 @@ Get the application’s global state.
460
533
461
534
* ** Returns:**
462
535
The application’s global state
536
+ * ** Example:**
537
+ ``` pycon
538
+ >>> global_state = client.get_global_state()
539
+ ```
463
540
464
541
#### get_box_names() → list[[ algokit_utils.models.state.BoxName] ( ../../models/state/index.md#algokit_utils.models.state.BoxName )]
465
542
466
543
Get all box names for the application.
467
544
468
545
* ** Returns:**
469
546
List of box names
547
+ * ** Example:**
548
+ ``` pycon
549
+ >>> box_names = client.get_box_names()
550
+ ```
470
551
471
552
#### get_box_value(name: algokit_utils.models.state.BoxIdentifier) → bytes
472
553
@@ -476,6 +557,10 @@ Get the value of a box.
476
557
** name** – The box identifier
477
558
* ** Returns:**
478
559
The box value as bytes
560
+ * ** Example:**
561
+ ``` pycon
562
+ >>> box_value = client.get_box_value(box_name)
563
+ ```
479
564
480
565
#### get_box_value_from_abi_type(name: algokit_utils.models.state.BoxIdentifier, abi_type: algokit_utils.applications.abi.ABIType) → algokit_utils.applications.abi.ABIValue
481
566
@@ -486,6 +571,10 @@ Get a box value decoded according to an ABI type.
486
571
* ** abi_type** – The ABI type to decode as
487
572
* ** Returns:**
488
573
The decoded box value
574
+ * ** Example:**
575
+ ``` pycon
576
+ >>> box_value = client.get_box_value_from_abi_type(box_name, abi_type)
577
+ ```
489
578
490
579
#### get_box_values(filter_func: collections.abc.Callable[[[ algokit_utils.models.state.BoxName] ( ../../models/state/index.md#algokit_utils.models.state.BoxName )] , bool] | None = None) → list[[ algokit_utils.models.state.BoxValue] ( ../../models/state/index.md#algokit_utils.models.state.BoxValue )]
491
580
@@ -495,6 +584,10 @@ Get values for multiple boxes.
495
584
** filter_func** – Optional function to filter box names
496
585
* ** Returns:**
497
586
List of box values
587
+ * ** Example:**
588
+ ``` pycon
589
+ >>> box_values = client.get_box_values()
590
+ ```
498
591
499
592
#### get_box_values_from_abi_type(abi_type: algokit_utils.applications.abi.ABIType, filter_func: collections.abc.Callable[[[ algokit_utils.models.state.BoxName] ( ../../models/state/index.md#algokit_utils.models.state.BoxName )] , bool] | None = None) → list[[ algokit_utils.applications.abi.BoxABIValue] ( ../abi/index.md#algokit_utils.applications.abi.BoxABIValue )]
500
593
@@ -505,6 +598,10 @@ Get multiple box values decoded according to an ABI type.
505
598
* ** filter_func** – Optional function to filter box names
506
599
* ** Returns:**
507
600
List of decoded box values
601
+ * ** Example:**
602
+ ``` pycon
603
+ >>> box_values = client.get_box_values_from_abi_type(abi_type)
604
+ ```
508
605
509
606
#### fund_app_account(params: [ FundAppAccountParams] ( #algokit_utils.applications.app_client.FundAppAccountParams ) , send_params: [ algokit_utils.models.transaction.SendParams] ( ../../models/transaction/index.md#algokit_utils.models.transaction.SendParams ) | None = None) → [ algokit_utils.transactions.transaction_sender.SendSingleTransactionResult] ( ../../transactions/transaction_sender/index.md#algokit_utils.transactions.transaction_sender.SendSingleTransactionResult )
510
607
@@ -515,3 +612,7 @@ Fund the application’s account.
515
612
* ** send_params** – Send parameters, defaults to None
516
613
* ** Returns:**
517
614
The transaction result
615
+ * ** Example:**
616
+ ``` pycon
617
+ >>> result = client.fund_app_account(params)
618
+ ```
0 commit comments