@algorandfoundation/algokit-utils 9.2.1-beta.3 → 9.2.2-beta.1

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.
Files changed (75) hide show
  1. package/account/account.d.ts +28 -23
  2. package/account/get-account-config-from-environment.d.ts +2 -7
  3. package/account/get-account.d.ts +12 -14
  4. package/account/get-dispenser-account.d.ts +5 -9
  5. package/account/index.d.ts +5 -0
  6. package/account/mnemonic-account.d.ts +3 -7
  7. package/amount.d.ts +35 -40
  8. package/app-client.d.ts +6 -10
  9. package/app-deploy.d.ts +23 -25
  10. package/app.d.ts +46 -45
  11. package/asset.d.ts +12 -16
  12. package/config.d.ts +2 -7
  13. package/debugging/debugging.d.ts +1 -5
  14. package/debugging/index.d.ts +1 -0
  15. package/dispenser-client.d.ts +2 -7
  16. package/index.d.ts +18 -27
  17. package/indexer-lookup.d.ts +11 -18
  18. package/localnet/get-kmd-wallet-account.d.ts +7 -9
  19. package/localnet/get-localnet-dispenser-account.d.ts +5 -7
  20. package/localnet/get-or-create-kmd-wallet-account.d.ts +8 -10
  21. package/localnet/index.d.ts +4 -0
  22. package/localnet/is-localnet.d.ts +3 -7
  23. package/network-client.d.ts +15 -17
  24. package/package.json +1 -1
  25. package/testing/_asset.d.ts +3 -0
  26. package/testing/account.d.ts +9 -11
  27. package/testing/fixtures/algokit-log-capture-fixture.d.ts +2 -7
  28. package/testing/fixtures/algorand-fixture.d.ts +4 -9
  29. package/testing/fixtures/index.d.ts +2 -0
  30. package/testing/index.d.ts +5 -7
  31. package/testing/indexer.d.ts +1 -5
  32. package/testing/test-logger.d.ts +36 -41
  33. package/testing/transaction-logger.d.ts +27 -30
  34. package/transaction/index.d.ts +2 -0
  35. package/transaction/legacy-bridge.d.ts +35 -0
  36. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +5 -7
  37. package/transaction/resolve-signed-transactions.d.ts +16 -0
  38. package/transaction/transaction.d.ts +35 -34
  39. package/transfer/index.d.ts +2 -0
  40. package/transfer/transfer-algos.d.ts +5 -9
  41. package/transfer/transfer.d.ts +8 -11
  42. package/types/account-manager.d.ts +429 -432
  43. package/types/account.d.ts +202 -192
  44. package/types/algo-http-client-with-retry.d.ts +10 -15
  45. package/types/algorand-client-transaction-creator.d.ts +771 -778
  46. package/types/algorand-client-transaction-sender.d.ts +1085 -1090
  47. package/types/algorand-client.d.ts +236 -239
  48. package/types/amount.d.ts +43 -47
  49. package/types/app-arc56.d.ts +272 -235
  50. package/types/app-client.d.ts +1151 -1128
  51. package/types/app-deployer.d.ts +141 -139
  52. package/types/app-factory.d.ts +783 -762
  53. package/types/app-manager.d.ts +310 -304
  54. package/types/app-spec.d.ts +117 -118
  55. package/types/app.d.ts +241 -229
  56. package/types/asset-manager.d.ts +199 -204
  57. package/types/asset.d.ts +91 -95
  58. package/types/async-event-emitter.d.ts +13 -18
  59. package/types/client-manager.d.ts +451 -453
  60. package/types/composer.d.ts +1257 -1210
  61. package/types/config.d.ts +48 -53
  62. package/types/debugging.d.ts +23 -25
  63. package/types/dispenser-client.d.ts +52 -57
  64. package/types/expand.d.ts +3 -5
  65. package/types/indexer.d.ts +66 -70
  66. package/types/instance-of.d.ts +3 -5
  67. package/types/kmd-account-manager.d.ts +70 -75
  68. package/types/lifecycle-events.d.ts +8 -13
  69. package/types/logging.d.ts +11 -15
  70. package/types/logic-error.d.ts +29 -33
  71. package/types/network-client.d.ts +27 -32
  72. package/types/testing.d.ts +132 -131
  73. package/types/transaction.d.ts +110 -110
  74. package/types/transfer.d.ts +66 -70
  75. package/util.d.ts +48 -0
@@ -1,935 +1,961 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { TransactionSignerAccount } from "./account.js";
3
- import { Expand } from "./expand.js";
4
- import { ABIAppCallArgs, ABIReturn, AppCallArgs, AppCallTransactionResult, AppCallType, AppCompilationResult, AppDeployMetadata, AppLookup, AppMetadata, AppReference, AppReturn, AppState, AppStorageSchema, BoxName, CompiledTeal, OnSchemaBreak, OnUpdate, RawAppCallArgs, SendAppTransactionResult, TealTemplateParams } from "./app.js";
5
- import { ConfirmedTransactionResult, SendParams, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionNote } from "./transaction.js";
6
- import { AppManager, BoxIdentifier, BoxReference, ResourceReference } from "./app-manager.js";
7
- import { AppCallMethodCall, AppDeleteMethodCall, AppMethodCall, AppMethodCallParams, AppMethodCallTransactionArgument, CommonAppCallParams, PaymentParams } from "./composer.js";
8
- import { ABIStruct, Arc56Contract, Arc56Method, ProgramSourceInfo } from "./app-arc56.js";
9
- import { AppLookup as AppLookup$1 } from "./app-deployer.js";
10
- import { AppSpec } from "./app-spec.js";
11
- import { AlgorandClient } from "./algorand-client.js";
12
- import algosdk, { Address } from "algosdk";
13
-
14
- //#region src/types/app-client.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { TransactionSignerAccount } from './account';
3
+ import { type AlgorandClient } from './algorand-client';
4
+ import { AlgoAmount } from './amount';
5
+ import { ABIAppCallArgs, ABIReturn, AppCallArgs, AppCallTransactionResult, AppCallType, AppCompilationResult, AppMetadata, AppReference, AppReturn, AppState, AppStorageSchema, BoxName, AppLookup as LegacyAppLookup, OnSchemaBreak, OnUpdate, RawAppCallArgs, SendAppTransactionResult, TealTemplateParams } from './app';
6
+ import { ABIStruct, Arc56Contract, Arc56Method, ProgramSourceInfo } from './app-arc56';
7
+ import { AppLookup } from './app-deployer';
8
+ import { AppManager, BoxIdentifier } from './app-manager';
9
+ import { AppSpec } from './app-spec';
10
+ import { AppCallMethodCall, AppDeleteMethodCall, AppMethodCall, AppMethodCallTransactionArgument, CommonAppCallParams, PaymentParams } from './composer';
11
+ import { Expand } from './expand';
12
+ import { SendParams, SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
13
+ import ABIMethod = algosdk.ABIMethod;
14
+ import ABIMethodParams = algosdk.ABIMethodParams;
15
+ import ABIType = algosdk.ABIType;
16
+ import ABIValue = algosdk.ABIValue;
17
+ import Algodv2 = algosdk.Algodv2;
18
+ import Indexer = algosdk.Indexer;
19
+ import OnApplicationComplete = algosdk.OnApplicationComplete;
20
+ import SourceMap = algosdk.ProgramSourceMap;
21
+ import SuggestedParams = algosdk.SuggestedParams;
22
+ import TransactionSigner = algosdk.TransactionSigner;
15
23
  /** Configuration to resolve app by creator and name `getCreatorAppsByName` */
16
- type ResolveAppByCreatorAndNameBase = {
17
- /** The address of the app creator account to resolve the app by */creatorAddress: Address | string; /** The optional name override to resolve the app by within the creator account (default: uses the name in the ABI contract) */
18
- name?: string;
19
- /** The mechanism to find an existing app instance metadata for the given creator and name; either:
20
- * * An indexer instance to search the creator account apps; or
21
- * * The cached value of the existing apps for the given creator from `getCreatorAppsByName`
22
- */
23
- findExistingUsing: Indexer | AppLookup;
24
+ export type ResolveAppByCreatorAndNameBase = {
25
+ /** The address of the app creator account to resolve the app by */
26
+ creatorAddress: Address | string;
27
+ /** The optional name override to resolve the app by within the creator account (default: uses the name in the ABI contract) */
28
+ name?: string;
29
+ /** The mechanism to find an existing app instance metadata for the given creator and name; either:
30
+ * * An indexer instance to search the creator account apps; or
31
+ * * The cached value of the existing apps for the given creator from `getCreatorAppsByName`
32
+ */
33
+ findExistingUsing: Indexer | LegacyAppLookup;
24
34
  };
25
35
  /** Configuration to resolve app by creator and name `getCreatorAppsByName` */
26
- type ResolveAppByCreatorAndName = ResolveAppByCreatorAndNameBase & {
27
- /** How the app ID is resolved, either by `'id'` or `'creatorAndName'`; must be `'creatorAndName'` if you want to use `deploy` */resolveBy: 'creatorAndName';
36
+ export type ResolveAppByCreatorAndName = ResolveAppByCreatorAndNameBase & {
37
+ /** How the app ID is resolved, either by `'id'` or `'creatorAndName'`; must be `'creatorAndName'` if you want to use `deploy` */
38
+ resolveBy: 'creatorAndName';
28
39
  };
29
40
  /** Configuration to resolve app by ID */
30
- interface ResolveAppByIdBase {
31
- /** The id of an existing app to call using this client, or 0 if the app hasn't been created yet */
32
- id: number | bigint;
33
- /** The optional name to use to mark the app when deploying `ApplicationClient.deploy` (default: uses the name in the ABI contract) */
34
- name?: string;
41
+ export interface ResolveAppByIdBase {
42
+ /** The id of an existing app to call using this client, or 0 if the app hasn't been created yet */
43
+ id: number | bigint;
44
+ /** The optional name to use to mark the app when deploying `ApplicationClient.deploy` (default: uses the name in the ABI contract) */
45
+ name?: string;
35
46
  }
36
- interface ResolveAppById extends ResolveAppByIdBase {
37
- /** How the app ID is resolved, either by `'id'` or `'creatorAndName'`; must be `'creatorAndName'` if you want to use `deploy` */
38
- resolveBy: 'id';
47
+ export interface ResolveAppById extends ResolveAppByIdBase {
48
+ /** How the app ID is resolved, either by `'id'` or `'creatorAndName'`; must be `'creatorAndName'` if you want to use `deploy` */
49
+ resolveBy: 'id';
39
50
  }
40
51
  /** The details of an AlgoKit Utils deployed app */
41
- type AppDetailsBase = {
42
- /** Default sender to use for transactions issued by this application client */sender?: SendTransactionFrom; /** Default suggested params object to use */
43
- params?: SuggestedParams;
44
- /** Optionally provide any deploy-time parameters to replace in the TEAL code; if specified here will get
45
- * used in calls to `deploy`, `create` and `update` unless overridden in those calls
46
- */
47
- deployTimeParams?: TealTemplateParams;
52
+ export type AppDetailsBase = {
53
+ /** Default sender to use for transactions issued by this application client */
54
+ sender?: SendTransactionFrom;
55
+ /** Default suggested params object to use */
56
+ params?: SuggestedParams;
57
+ /** Optionally provide any deploy-time parameters to replace in the TEAL code; if specified here will get
58
+ * used in calls to `deploy`, `create` and `update` unless overridden in those calls
59
+ */
60
+ deployTimeParams?: TealTemplateParams;
48
61
  };
49
62
  /** The details of an AlgoKit Utils deployed app */
50
- type AppDetails = AppDetailsBase & (ResolveAppById | ResolveAppByCreatorAndName);
63
+ export type AppDetails = AppDetailsBase & (ResolveAppById | ResolveAppByCreatorAndName);
51
64
  /** The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app */
52
- type AppSpecAppDetailsBase = {
53
- /** The ARC-0032 application spec as either:
54
- * * Parsed JSON `AppSpec`
55
- * * Raw JSON string
56
- */
57
- app: AppSpec | string;
65
+ export type AppSpecAppDetailsBase = {
66
+ /** The ARC-0032 application spec as either:
67
+ * * Parsed JSON `AppSpec`
68
+ * * Raw JSON string
69
+ */
70
+ app: AppSpec | string;
58
71
  };
59
72
  /** The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app by id*/
60
- type AppSpecAppDetailsById = AppSpecAppDetailsBase & AppDetailsBase & ResolveAppByIdBase;
73
+ export type AppSpecAppDetailsById = AppSpecAppDetailsBase & AppDetailsBase & ResolveAppByIdBase;
61
74
  /** The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app by creator and name*/
62
- type AppSpecAppDetailsByCreatorAndName = AppSpecAppDetailsBase & AppDetailsBase & ResolveAppByCreatorAndNameBase;
75
+ export type AppSpecAppDetailsByCreatorAndName = AppSpecAppDetailsBase & AppDetailsBase & ResolveAppByCreatorAndNameBase;
63
76
  /** The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app */
64
- type AppSpecAppDetails = AppSpecAppDetailsBase & AppDetails;
77
+ export type AppSpecAppDetails = AppSpecAppDetailsBase & AppDetails;
65
78
  /** Core parameters to pass into ApplicationClient.deploy */
66
- interface AppClientDeployCoreParams {
67
- /** The version of the contract, uses "1.0" by default */
68
- version?: string;
69
- /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
70
- sender?: SendTransactionFrom;
71
- /** Parameters to control transaction sending */
72
- sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
73
- /** Whether or not to allow updates in the contract using the deploy-time updatability control if present in your contract.
74
- * If this is not specified then it will automatically be determined based on the AppSpec definition
75
- **/
76
- allowUpdate?: boolean;
77
- /** Whether or not to allow deletes in the contract using the deploy-time deletability control if present in your contract.
78
- * If this is not specified then it will automatically be determined based on the AppSpec definition
79
- **/
80
- allowDelete?: boolean;
81
- /** What action to perform if a schema break is detected */
82
- onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak;
83
- /** What action to perform if a TEAL update is detected */
84
- onUpdate?: 'update' | 'replace' | 'append' | 'fail' | OnUpdate;
79
+ export interface AppClientDeployCoreParams {
80
+ /** The version of the contract, uses "1.0" by default */
81
+ version?: string;
82
+ /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
83
+ sender?: SendTransactionFrom;
84
+ /** Parameters to control transaction sending */
85
+ sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
86
+ /** Whether or not to allow updates in the contract using the deploy-time updatability control if present in your contract.
87
+ * If this is not specified then it will automatically be determined based on the AppSpec definition
88
+ **/
89
+ allowUpdate?: boolean;
90
+ /** Whether or not to allow deletes in the contract using the deploy-time deletability control if present in your contract.
91
+ * If this is not specified then it will automatically be determined based on the AppSpec definition
92
+ **/
93
+ allowDelete?: boolean;
94
+ /** What action to perform if a schema break is detected */
95
+ onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak;
96
+ /** What action to perform if a TEAL update is detected */
97
+ onUpdate?: 'update' | 'replace' | 'append' | 'fail' | OnUpdate;
85
98
  }
86
99
  /** Call interface parameters to pass into ApplicationClient.deploy */
87
- interface AppClientDeployCallInterfaceParams {
88
- /** Any deploy-time parameters to replace in the TEAL code */
89
- deployTimeParams?: TealTemplateParams;
90
- /** Any args to pass to any create transaction that is issued as part of deployment */
91
- createArgs?: AppClientCallArgs;
92
- /** Override the on-completion action for the create call; defaults to NoOp */
93
- createOnCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
94
- /** Any args to pass to any update transaction that is issued as part of deployment */
95
- updateArgs?: AppClientCallArgs;
96
- /** Any args to pass to any delete transaction that is issued as part of deployment */
97
- deleteArgs?: AppClientCallArgs;
100
+ export interface AppClientDeployCallInterfaceParams {
101
+ /** Any deploy-time parameters to replace in the TEAL code */
102
+ deployTimeParams?: TealTemplateParams;
103
+ /** Any args to pass to any create transaction that is issued as part of deployment */
104
+ createArgs?: AppClientCallArgs;
105
+ /** Override the on-completion action for the create call; defaults to NoOp */
106
+ createOnCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
107
+ /** Any args to pass to any update transaction that is issued as part of deployment */
108
+ updateArgs?: AppClientCallArgs;
109
+ /** Any args to pass to any delete transaction that is issued as part of deployment */
110
+ deleteArgs?: AppClientCallArgs;
98
111
  }
99
112
  /** Parameters to pass into ApplicationClient.deploy */
100
- interface AppClientDeployParams extends AppClientDeployCoreParams, AppClientDeployCallInterfaceParams {
101
- /** Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. */
102
- schema?: Partial<AppStorageSchema>;
113
+ export interface AppClientDeployParams extends AppClientDeployCoreParams, AppClientDeployCallInterfaceParams {
114
+ /** Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. */
115
+ schema?: Partial<AppStorageSchema>;
103
116
  }
104
- type AppClientCallRawArgs = RawAppCallArgs;
105
- interface AppClientCallABIArgs extends Omit<ABIAppCallArgs, 'method'> {
106
- /** If calling an ABI method then either the name of the method, or the ABI signature */
107
- method: string;
117
+ export type AppClientCallRawArgs = RawAppCallArgs;
118
+ export interface AppClientCallABIArgs extends Omit<ABIAppCallArgs, 'method'> {
119
+ /** If calling an ABI method then either the name of the method, or the ABI signature */
120
+ method: string;
108
121
  }
109
122
  /** The arguments to pass to an Application Client smart contract call */
110
- type AppClientCallArgs = AppClientCallRawArgs | AppClientCallABIArgs;
123
+ export type AppClientCallArgs = AppClientCallRawArgs | AppClientCallABIArgs;
111
124
  /** Common (core) parameters to construct a ApplicationClient contract call */
112
- interface AppClientCallCoreParams {
113
- /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
114
- sender?: SendTransactionFrom;
115
- /** The transaction note for the smart contract call */
116
- note?: TransactionNote;
117
- /** Parameters to control transaction sending */
118
- sendParams?: SendTransactionParams;
125
+ export interface AppClientCallCoreParams {
126
+ /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
127
+ sender?: SendTransactionFrom;
128
+ /** The transaction note for the smart contract call */
129
+ note?: TransactionNote;
130
+ /** Parameters to control transaction sending */
131
+ sendParams?: SendTransactionParams;
119
132
  }
120
133
  /** Parameters to construct a ApplicationClient contract call */
121
- type AppClientCallParams = AppClientCallArgs & AppClientCallCoreParams;
134
+ export type AppClientCallParams = AppClientCallArgs & AppClientCallCoreParams;
122
135
  /** Parameters to construct a ApplicationClient clear state contract call */
123
- type AppClientClearStateParams = AppClientCallRawArgs & AppClientCallCoreParams;
124
- interface AppClientCompilationParams {
125
- /** Any deploy-time parameters to replace in the TEAL code */
126
- deployTimeParams?: TealTemplateParams;
127
- /** Whether or not the contract should have deploy-time immutability control set, undefined = ignore */
128
- updatable?: boolean;
129
- /** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
130
- deletable?: boolean;
136
+ export type AppClientClearStateParams = AppClientCallRawArgs & AppClientCallCoreParams;
137
+ export interface AppClientCompilationParams {
138
+ /** Any deploy-time parameters to replace in the TEAL code */
139
+ deployTimeParams?: TealTemplateParams;
140
+ /** Whether or not the contract should have deploy-time immutability control set, undefined = ignore */
141
+ updatable?: boolean;
142
+ /** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
143
+ deletable?: boolean;
131
144
  }
132
145
  /** On-complete action parameter for creating a contract using ApplicationClient */
133
- type AppClientCreateOnComplete = {
134
- /** Override the on-completion action for the create call; defaults to NoOp */onCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
146
+ export type AppClientCreateOnComplete = {
147
+ /** Override the on-completion action for the create call; defaults to NoOp */
148
+ onCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
135
149
  };
136
150
  /** Parameters for creating a contract using ApplicationClient */
137
- type AppClientCreateParams = AppClientCallParams & AppClientCompilationParams & AppClientCreateOnComplete & {
138
- /** Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. */schema?: Partial<AppStorageSchema>;
151
+ export type AppClientCreateParams = AppClientCallParams & AppClientCompilationParams & AppClientCreateOnComplete & {
152
+ /** Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. */
153
+ schema?: Partial<AppStorageSchema>;
139
154
  };
140
155
  /** Parameters for updating a contract using ApplicationClient */
141
- type AppClientUpdateParams = AppClientCallParams & AppClientCompilationParams;
156
+ export type AppClientUpdateParams = AppClientCallParams & AppClientCompilationParams;
142
157
  /** Parameters for funding an app account */
143
- interface FundAppAccountParams {
144
- amount: AlgoAmount;
145
- /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
146
- sender?: SendTransactionFrom;
147
- /** The transaction note for the smart contract call */
148
- note?: TransactionNote;
149
- /** Parameters to control transaction sending */
150
- sendParams?: SendTransactionParams;
158
+ export interface FundAppAccountParams {
159
+ amount: AlgoAmount;
160
+ /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
161
+ sender?: SendTransactionFrom;
162
+ /** The transaction note for the smart contract call */
163
+ note?: TransactionNote;
164
+ /** Parameters to control transaction sending */
165
+ sendParams?: SendTransactionParams;
151
166
  }
152
167
  /** Source maps for an Algorand app */
153
- interface AppSourceMaps {
154
- /** The source map of the approval program */
155
- approvalSourceMap: SourceMapExport;
156
- /** The source map of the clear program */
157
- clearSourceMap: SourceMapExport;
168
+ export interface AppSourceMaps {
169
+ /** The source map of the approval program */
170
+ approvalSourceMap: SourceMapExport;
171
+ /** The source map of the clear program */
172
+ clearSourceMap: SourceMapExport;
158
173
  }
159
- interface SourceMapExport {
160
- version: number;
161
- sources: string[];
162
- names: string[];
163
- mappings: string;
174
+ export interface SourceMapExport {
175
+ version: number;
176
+ sources: string[];
177
+ names: string[];
178
+ mappings: string;
164
179
  }
165
180
  /**
166
181
  * The result of asking an `AppClient` to compile a program.
167
182
  *
168
183
  * Always contains the compiled bytecode, and may contain the result of compiling TEAL (including sourcemap) if it was available.
169
184
  */
170
- interface AppClientCompilationResult extends Partial<AppCompilationResult> {
171
- /** The compiled bytecode of the approval program, ready to deploy to algod */
172
- approvalProgram: Uint8Array;
173
- /** The compiled bytecode of the clear state program, ready to deploy to algod */
174
- clearStateProgram: Uint8Array;
185
+ export interface AppClientCompilationResult extends Partial<AppCompilationResult> {
186
+ /** The compiled bytecode of the approval program, ready to deploy to algod */
187
+ approvalProgram: Uint8Array;
188
+ /** The compiled bytecode of the clear state program, ready to deploy to algod */
189
+ clearStateProgram: Uint8Array;
175
190
  }
176
191
  /** Parameters to create an app client */
177
- interface AppClientParams {
178
- /** The ID of the app instance this client should make calls against. */
179
- appId: bigint;
180
- /** The ARC-56 or ARC-32 application spec as either:
181
- * * Parsed JSON ARC-56 `Contract`
182
- * * Parsed JSON ARC-32 `AppSpec`
183
- * * Raw JSON string (in either ARC-56 or ARC-32 format)
184
- */
185
- appSpec: Arc56Contract | AppSpec | string;
186
- /** An `AlgorandClient` instance */
187
- algorand: AlgorandClient;
188
- /**
189
- * Optional override for the app name; used for on-chain metadata and lookups.
190
- * Defaults to the ARC-32/ARC-56 app spec name
191
- */
192
- appName?: string;
193
- /** Optional address to use for the account to use as the default sender for calls. */
194
- defaultSender?: Address | string;
195
- /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */
196
- defaultSigner?: TransactionSigner;
197
- /** Optional source map for the approval program */
198
- approvalSourceMap?: SourceMap;
199
- /** Optional source map for the clear state program */
200
- clearSourceMap?: SourceMap;
192
+ export interface AppClientParams {
193
+ /** The ID of the app instance this client should make calls against. */
194
+ appId: bigint;
195
+ /** The ARC-56 or ARC-32 application spec as either:
196
+ * * Parsed JSON ARC-56 `Contract`
197
+ * * Parsed JSON ARC-32 `AppSpec`
198
+ * * Raw JSON string (in either ARC-56 or ARC-32 format)
199
+ */
200
+ appSpec: Arc56Contract | AppSpec | string;
201
+ /** An `AlgorandClient` instance */
202
+ algorand: AlgorandClient;
203
+ /**
204
+ * Optional override for the app name; used for on-chain metadata and lookups.
205
+ * Defaults to the ARC-32/ARC-56 app spec name
206
+ */
207
+ appName?: string;
208
+ /** Optional address to use for the account to use as the default sender for calls. */
209
+ defaultSender?: Address | string;
210
+ /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */
211
+ defaultSigner?: TransactionSigner;
212
+ /** Optional source map for the approval program */
213
+ approvalSourceMap?: SourceMap;
214
+ /** Optional source map for the clear state program */
215
+ clearSourceMap?: SourceMap;
201
216
  }
202
217
  /** Parameters to clone an app client */
203
- type CloneAppClientParams = Expand<Partial<Omit<AppClientParams, 'algorand' | 'appSpec'>>>;
218
+ export type CloneAppClientParams = Expand<Partial<Omit<AppClientParams, 'algorand' | 'appSpec'>>>;
204
219
  /** onComplete parameter for a non-update app call */
205
- type CallOnComplete = {
206
- /** On-complete of the call; defaults to no-op */onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>;
220
+ export type CallOnComplete = {
221
+ /** On-complete of the call; defaults to no-op */
222
+ onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>;
207
223
  };
208
224
  /** AppClient common parameters for a bare app call */
209
- type AppClientBareCallParams = Expand<Omit<CommonAppCallParams, 'appId' | 'sender' | 'onComplete'> & {
210
- /** The address of the account sending the transaction, if undefined then the app client's defaultSender is used. */sender?: Address | string;
225
+ export type AppClientBareCallParams = Expand<Omit<CommonAppCallParams, 'appId' | 'sender' | 'onComplete'> & {
226
+ /** The address of the account sending the transaction, if undefined then the app client's defaultSender is used. */
227
+ sender?: Address | string;
211
228
  }>;
212
229
  /** AppClient common parameters for an ABI method call */
213
- type AppClientMethodCallParams = Expand<Omit<CommonAppCallParams, 'appId' | 'sender' | 'method' | 'args'> & {
214
- /** The address of the account sending the transaction, if undefined then the app client's defaultSender is used. */sender?: Address | string;
215
- /** The method name or method signature to call if an ABI call is being emitted
216
- * @example Method name
217
- * `my_method`
218
- * @example Method signature
219
- * `my_method(unit64,string)bytes`
220
- */
221
- method: string;
222
- /** Arguments to the ABI method, either:
223
- * * An ABI value
224
- * * An ARC-56 struct
225
- * * A transaction with explicit signer
226
- * * A transaction (where the signer will be automatically assigned)
227
- * * An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
228
- * * Another method call (via method call params object)
229
- * * undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)
230
- */
231
- args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[];
230
+ export type AppClientMethodCallParams = Expand<Omit<CommonAppCallParams, 'appId' | 'sender' | 'method' | 'args'> & {
231
+ /** The address of the account sending the transaction, if undefined then the app client's defaultSender is used. */
232
+ sender?: Address | string;
233
+ /** The method name or method signature to call if an ABI call is being emitted
234
+ * @example Method name
235
+ * `my_method`
236
+ * @example Method signature
237
+ * `my_method(unit64,string)bytes`
238
+ */
239
+ method: string;
240
+ /** Arguments to the ABI method, either:
241
+ * * An ABI value
242
+ * * An ARC-56 struct
243
+ * * A transaction with explicit signer
244
+ * * A transaction (where the signer will be automatically assigned)
245
+ * * An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
246
+ * * Another method call (via method call params object)
247
+ * * undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)
248
+ */
249
+ args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[];
232
250
  }>;
233
251
  /** Parameters for funding an app account */
234
- type FundAppParams = Expand<Omit<PaymentParams, 'receiver' | 'sender'> & SendParams & {
235
- /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */sender?: Address | string;
252
+ export type FundAppParams = Expand<Omit<PaymentParams, 'receiver' | 'sender'> & SendParams & {
253
+ /** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
254
+ sender?: Address | string;
236
255
  }>;
237
256
  /** Resolve an app client instance by looking up an app created by the given creator with the given name */
238
- type ResolveAppClientByCreatorAndName = Expand<Omit<AppClientParams, 'appId'> & {
239
- /** The address of the creator account for the app */creatorAddress: Address | string;
240
- /** An optional cached app lookup that matches a name to on-chain details;
241
- * either this is needed or indexer is required to be passed in to this `ClientManager` on construction.
242
- */
243
- appLookupCache?: AppLookup$1; /** Whether or not to ignore the `AppDeployer` lookup cache and force an on-chain lookup, default: use any cached value */
244
- ignoreCache?: boolean;
257
+ export type ResolveAppClientByCreatorAndName = Expand<Omit<AppClientParams, 'appId'> & {
258
+ /** The address of the creator account for the app */
259
+ creatorAddress: Address | string;
260
+ /** An optional cached app lookup that matches a name to on-chain details;
261
+ * either this is needed or indexer is required to be passed in to this `ClientManager` on construction.
262
+ */
263
+ appLookupCache?: AppLookup;
264
+ /** Whether or not to ignore the `AppDeployer` lookup cache and force an on-chain lookup, default: use any cached value */
265
+ ignoreCache?: boolean;
245
266
  }>;
246
267
  /** Resolve an app client instance by looking up the current network. */
247
- type ResolveAppClientByNetwork = Expand<Omit<AppClientParams, 'appId'>>;
268
+ export type ResolveAppClientByNetwork = Expand<Omit<AppClientParams, 'appId'>>;
248
269
  /** ARC-56/ARC-32 application client that allows you to manage calls and
249
270
  * state for a specific deployed instance of an app (with a known app ID). */
250
- declare class AppClient {
251
- private _appId;
252
- private _appAddress;
253
- private _appName;
254
- private _appSpec;
255
- private _algorand;
256
- private _defaultSender?;
257
- private _defaultSigner?;
258
- private _approvalSourceMap;
259
- private _clearSourceMap;
260
- private _localStateMethods;
261
- private _globalStateMethods;
262
- private _boxStateMethods;
263
- private _paramsMethods;
264
- private _createTransactionsMethods;
265
- private _sendMethods;
266
- private _lastCompiled;
267
- /**
268
- * Create a new app client.
269
- * @param params The parameters to create the app client
270
- * @returns The `AppClient` instance
271
- * @example
272
- * ```typescript
273
- * const appClient = new AppClient({
274
- * appId: 12345678n,
275
- * appSpec: appSpec,
276
- * algorand: AlgorandClient.mainNet(),
277
- * })
278
- */
279
- constructor(params: AppClientParams);
280
- /**
281
- * Clone this app client with different params
282
- *
283
- * @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
284
- * @returns A new app client with the altered params
285
- * @example
286
- * ```typescript
287
- * const appClient2 = appClient.clone({ defaultSender: 'NEW_SENDER_ADDRESS' })
288
- * ```
289
- */
290
- clone(params: CloneAppClientParams): AppClient;
291
- /**
292
- * Returns a new `AppClient` client, resolving the app by creator address and name
293
- * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
294
- * @param params The parameters to create the app client
295
- * @returns The `AppClient` instance
296
- * @example
297
- * ```typescript
298
- * const appClient = await AppClient.fromCreatorAndName({
299
- * creatorAddress: 'CREATOR_ADDRESS',
300
- * name: 'APP_NAME',
301
- * appSpec: appSpec,
302
- * algorand: AlgorandClient.mainNet(),
303
- * })
304
- */
305
- static fromCreatorAndName(params: ResolveAppClientByCreatorAndName): Promise<AppClient>;
306
- /**
307
- * Returns an `AppClient` instance for the current network based on
308
- * pre-determined network-specific app IDs specified in the ARC-56 app spec.
309
- *
310
- * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
311
- * @param params The parameters to create the app client
312
- * @returns The `AppClient` instance
313
- * @example
314
- * ```typescript
315
- * const appClient = await AppClient.fromNetwork({
316
- * appSpec: appSpec,
317
- * algorand: AlgorandClient.mainNet(),
318
- * })
319
- */
320
- static fromNetwork(params: ResolveAppClientByNetwork): Promise<AppClient>;
321
- /**
322
- * Takes a string or parsed JSON object that could be ARC-32 or ARC-56 format and
323
- * normalises it into a parsed ARC-56 contract object.
324
- * @param spec The spec to normalise
325
- * @returns The normalised ARC-56 contract object
326
- * @example
327
- * ```typescript
328
- * const arc56AppSpec = AppClient.normaliseAppSpec(appSpec)
329
- * ```
330
- */
331
- static normaliseAppSpec(spec: Arc56Contract | AppSpec | string): Arc56Contract;
332
- /** The ID of the app instance this client is linked to. */
333
- get appId(): bigint;
334
- /** The app address of the app instance this client is linked to. */
335
- get appAddress(): algosdk.Address;
336
- /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
337
- get appName(): string;
338
- /** The ARC-56 app spec being used */
339
- get appSpec(): Arc56Contract;
340
- /** A reference to the underlying `AlgorandClient` this app client is using. */
341
- get algorand(): AlgorandClient;
342
- /** Get parameters to create transactions for the current app.
343
- *
344
- * A good mental model for this is that these parameters represent a deferred transaction creation.
345
- * @example Create a transaction in the future using Algorand Client
346
- * ```typescript
347
- * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
348
- * // ...
349
- * await algorand.send.AppMethodCall(myMethodCall)
350
- * ```
351
- * @example Define a nested transaction as an ABI argument
352
- * ```typescript
353
- * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
354
- * await appClient.send.call({method: 'my_method2', args: [myMethodCall]})
355
- * ```
356
- */
357
- get params(): {
271
+ export declare class AppClient {
272
+ private _appId;
273
+ private _appAddress;
274
+ private _appName;
275
+ private _appSpec;
276
+ private _algorand;
277
+ private _defaultSender?;
278
+ private _defaultSigner?;
279
+ private _approvalSourceMap;
280
+ private _clearSourceMap;
281
+ private _localStateMethods;
282
+ private _globalStateMethods;
283
+ private _boxStateMethods;
284
+ private _paramsMethods;
285
+ private _createTransactionsMethods;
286
+ private _sendMethods;
287
+ private _lastCompiled;
358
288
  /**
359
- * Return params for a payment transaction to fund the app account
360
- * @param params The parameters for the fund app accont payment transaction
361
- * @returns The parameters which can be used to create a fund app account payment transaction
289
+ * Create a new app client.
290
+ * @param params The parameters to create the app client
291
+ * @returns The `AppClient` instance
292
+ * @example
293
+ * ```typescript
294
+ * const appClient = new AppClient({
295
+ * appId: 12345678n,
296
+ * appSpec: appSpec,
297
+ * algorand: AlgorandClient.mainNet(),
298
+ * })
362
299
  */
363
- fundAppAccount: (params: FundAppParams) => {
364
- sender: algosdk.Address;
365
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
366
- receiver: algosdk.Address;
367
- rekeyTo?: (string | Address) | undefined;
368
- note?: (Uint8Array | string) | undefined;
369
- lease?: (Uint8Array | string) | undefined;
370
- staticFee?: AlgoAmount | undefined;
371
- extraFee?: AlgoAmount | undefined;
372
- maxFee?: AlgoAmount | undefined;
373
- validityWindow?: number | bigint | undefined;
374
- firstValidRound?: bigint | undefined;
375
- lastValidRound?: bigint | undefined;
376
- amount: AlgoAmount;
377
- closeRemainderTo?: (string | Address) | undefined;
378
- maxRoundsToWaitForConfirmation?: number | undefined;
379
- suppressLog?: boolean | undefined;
380
- populateAppCallResources?: boolean | undefined;
381
- coverAppCallInnerTransactionFees?: boolean | undefined;
382
- };
300
+ constructor(params: AppClientParams);
383
301
  /**
384
- * Return params for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
385
- * @param params The parameters for the update ABI method call
386
- * @returns The parameters which can be used to create an update ABI method call
302
+ * Clone this app client with different params
303
+ *
304
+ * @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
305
+ * @returns A new app client with the altered params
306
+ * @example
307
+ * ```typescript
308
+ * const appClient2 = appClient.clone({ defaultSender: 'NEW_SENDER_ADDRESS' })
309
+ * ```
387
310
  */
388
- update: (params: AppClientMethodCallParams & AppClientCompilationParams) => Promise<{
389
- /** The compiled bytecode of the approval program, ready to deploy to algod */approvalProgram: Uint8Array; /** The compiled bytecode of the clear state program, ready to deploy to algod */
390
- clearStateProgram: Uint8Array;
391
- compiledApproval?: CompiledTeal | undefined;
392
- compiledClear?: CompiledTeal | undefined;
393
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
394
- rekeyTo?: (string | Address) | undefined;
395
- note?: (Uint8Array | string) | undefined;
396
- lease?: (Uint8Array | string) | undefined;
397
- staticFee?: AlgoAmount | undefined;
398
- extraFee?: AlgoAmount | undefined;
399
- maxFee?: AlgoAmount | undefined;
400
- validityWindow?: number | bigint | undefined;
401
- firstValidRound?: bigint | undefined;
402
- lastValidRound?: bigint | undefined;
403
- onComplete?: algosdk.OnApplicationComplete | undefined;
404
- accountReferences?: (string | Address)[] | undefined;
405
- appReferences?: bigint[] | undefined;
406
- assetReferences?: bigint[] | undefined;
407
- boxReferences?: (BoxReference | BoxIdentifier)[];
408
- accessReferences?: ResourceReference[] | undefined;
409
- rejectVersion?: number | undefined;
410
- sender?: (Address | string) | undefined;
411
- method: string;
412
- args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[]; /** Any deploy-time parameters to replace in the TEAL code */
413
- deployTimeParams?: TealTemplateParams; /** Whether or not the contract should have deploy-time immutability control set, undefined = ignore */
414
- updatable?: boolean; /** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
415
- deletable?: boolean;
416
- } & {
417
- appId: bigint;
418
- sender: algosdk.Address;
419
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
420
- method: Arc56Method;
421
- onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
422
- args: (algosdk.Transaction | Promise<algosdk.Transaction> | algosdk.ABIValue | algosdk.TransactionWithSigner | AppMethodCall<{
423
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
424
- sender: string | Address;
425
- rekeyTo?: (string | Address) | undefined;
426
- note?: (Uint8Array | string) | undefined;
427
- lease?: (Uint8Array | string) | undefined;
428
- staticFee?: AlgoAmount | undefined;
429
- extraFee?: AlgoAmount | undefined;
430
- maxFee?: AlgoAmount | undefined;
431
- validityWindow?: number | bigint | undefined;
432
- firstValidRound?: bigint | undefined;
433
- lastValidRound?: bigint | undefined;
434
- onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
435
- args?: Uint8Array[] | undefined;
436
- accountReferences?: (string | Address)[] | undefined;
437
- appReferences?: bigint[] | undefined;
438
- assetReferences?: bigint[] | undefined;
439
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
440
- accessReferences?: ResourceReference[] | undefined;
441
- rejectVersion?: number | undefined;
442
- approvalProgram: string | Uint8Array;
443
- clearStateProgram: string | Uint8Array;
444
- schema?: {
445
- globalInts: number;
446
- globalByteSlices: number;
447
- localInts: number;
448
- localByteSlices: number;
449
- } | undefined;
450
- extraProgramPages?: number | undefined;
451
- }> | AppMethodCall<{
452
- sender: string | Address;
453
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
454
- rekeyTo?: (string | Address) | undefined;
455
- note?: (Uint8Array | string) | undefined;
456
- lease?: (Uint8Array | string) | undefined;
457
- staticFee?: AlgoAmount | undefined;
458
- extraFee?: AlgoAmount | undefined;
459
- maxFee?: AlgoAmount | undefined;
460
- validityWindow?: number | bigint | undefined;
461
- firstValidRound?: bigint | undefined;
462
- lastValidRound?: bigint | undefined;
463
- appId: bigint;
464
- onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
465
- args?: Uint8Array[] | undefined;
466
- accountReferences?: (string | Address)[] | undefined;
467
- appReferences?: bigint[] | undefined;
468
- assetReferences?: bigint[] | undefined;
469
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
470
- accessReferences?: ResourceReference[] | undefined;
471
- rejectVersion?: number | undefined;
472
- approvalProgram: string | Uint8Array;
473
- clearStateProgram: string | Uint8Array;
474
- }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
475
- }>;
311
+ clone(params: CloneAppClientParams): AppClient;
476
312
  /**
477
- * Return params for an opt-in ABI call
478
- * @param params The parameters for the opt-in ABI method call
479
- * @returns The parameters which can be used to create an opt-in ABI method call
313
+ * Returns a new `AppClient` client, resolving the app by creator address and name
314
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
315
+ * @param params The parameters to create the app client
316
+ * @returns The `AppClient` instance
317
+ * @example
318
+ * ```typescript
319
+ * const appClient = await AppClient.fromCreatorAndName({
320
+ * creatorAddress: 'CREATOR_ADDRESS',
321
+ * name: 'APP_NAME',
322
+ * appSpec: appSpec,
323
+ * algorand: AlgorandClient.mainNet(),
324
+ * })
480
325
  */
481
- optIn: (params: AppClientMethodCallParams) => Promise<AppCallMethodCall>;
326
+ static fromCreatorAndName(params: ResolveAppClientByCreatorAndName): Promise<AppClient>;
482
327
  /**
483
- * Return params for an delete ABI call
484
- * @param params The parameters for the delete ABI method call
485
- * @returns The parameters which can be used to create a delete ABI method call
486
- */
487
- delete: (params: AppClientMethodCallParams) => Promise<AppDeleteMethodCall>;
488
- /** Return params for an close out ABI call
489
- * @param params The parameters for the close out ABI method call
490
- * @returns The parameters which can be used to create a close out ABI method call
328
+ * Returns an `AppClient` instance for the current network based on
329
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
330
+ *
331
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
332
+ * @param params The parameters to create the app client
333
+ * @returns The `AppClient` instance
334
+ * @example
335
+ * ```typescript
336
+ * const appClient = await AppClient.fromNetwork({
337
+ * appSpec: appSpec,
338
+ * algorand: AlgorandClient.mainNet(),
339
+ * })
491
340
  */
492
- closeOut: (params: AppClientMethodCallParams) => Promise<AppCallMethodCall>;
493
- /** Return params for an ABI call
494
- * @param params The parameters for the ABI method call
495
- * @returns The parameters which can be used to create an ABI method call
341
+ static fromNetwork(params: ResolveAppClientByNetwork): Promise<AppClient>;
342
+ /**
343
+ * Takes a string or parsed JSON object that could be ARC-32 or ARC-56 format and
344
+ * normalises it into a parsed ARC-56 contract object.
345
+ * @param spec The spec to normalise
346
+ * @returns The normalised ARC-56 contract object
347
+ * @example
348
+ * ```typescript
349
+ * const arc56AppSpec = AppClient.normaliseAppSpec(appSpec)
350
+ * ```
496
351
  */
497
- call: (params: AppClientMethodCallParams & CallOnComplete) => Promise<AppCallMethodCall>;
498
- } & {
499
- /** Interact with bare (raw) call parameters */bare: ReturnType<AppClient["getBareParamsMethods"]>;
500
- };
501
- /** Create transactions for the current app */
502
- get createTransaction(): {
503
- /** Return transaction for a payment transaction to fund the app account
504
- * @param params The parameters for the fund app account payment transaction
505
- * @returns A transaction which can be used to fund the app account
352
+ static normaliseAppSpec(spec: Arc56Contract | AppSpec | string): Arc56Contract;
353
+ /** The ID of the app instance this client is linked to. */
354
+ get appId(): bigint;
355
+ /** The app address of the app instance this client is linked to. */
356
+ get appAddress(): algosdk.Address;
357
+ /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
358
+ get appName(): string;
359
+ /** The ARC-56 app spec being used */
360
+ get appSpec(): Arc56Contract;
361
+ /** A reference to the underlying `AlgorandClient` this app client is using. */
362
+ get algorand(): AlgorandClient;
363
+ /** Get parameters to create transactions for the current app.
364
+ *
365
+ * A good mental model for this is that these parameters represent a deferred transaction creation.
366
+ * @example Create a transaction in the future using Algorand Client
367
+ * ```typescript
368
+ * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
369
+ * // ...
370
+ * await algorand.send.AppMethodCall(myMethodCall)
371
+ * ```
372
+ * @example Define a nested transaction as an ABI argument
373
+ * ```typescript
374
+ * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
375
+ * await appClient.send.call({method: 'my_method2', args: [myMethodCall]})
376
+ * ```
506
377
  */
507
- fundAppAccount: (params: FundAppParams) => Promise<algosdk.Transaction>;
378
+ get params(): {
379
+ /**
380
+ * Return params for a payment transaction to fund the app account
381
+ * @param params The parameters for the fund app accont payment transaction
382
+ * @returns The parameters which can be used to create a fund app account payment transaction
383
+ */
384
+ fundAppAccount: (params: FundAppParams) => {
385
+ sender: algosdk.Address;
386
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
387
+ receiver: algosdk.Address;
388
+ maxFee?: AlgoAmount | undefined;
389
+ note?: (Uint8Array | string) | undefined;
390
+ lease?: (Uint8Array | string) | undefined;
391
+ rekeyTo?: (string | Address) | undefined;
392
+ staticFee?: AlgoAmount | undefined;
393
+ extraFee?: AlgoAmount | undefined;
394
+ validityWindow?: number | bigint | undefined;
395
+ firstValidRound?: bigint | undefined;
396
+ lastValidRound?: bigint | undefined;
397
+ amount: AlgoAmount;
398
+ closeRemainderTo?: (string | Address) | undefined;
399
+ maxRoundsToWaitForConfirmation?: number | undefined;
400
+ suppressLog?: boolean | undefined;
401
+ populateAppCallResources?: boolean | undefined;
402
+ coverAppCallInnerTransactionFees?: boolean | undefined;
403
+ };
404
+ /**
405
+ * Return params for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
406
+ * @param params The parameters for the update ABI method call
407
+ * @returns The parameters which can be used to create an update ABI method call
408
+ */
409
+ update: (params: AppClientMethodCallParams & AppClientCompilationParams) => Promise<{
410
+ /** The compiled bytecode of the approval program, ready to deploy to algod */
411
+ approvalProgram: Uint8Array;
412
+ /** The compiled bytecode of the clear state program, ready to deploy to algod */
413
+ clearStateProgram: Uint8Array;
414
+ compiledApproval?: import("./app").CompiledTeal | undefined;
415
+ compiledClear?: import("./app").CompiledTeal | undefined;
416
+ maxFee?: AlgoAmount | undefined;
417
+ note?: (Uint8Array | string) | undefined;
418
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
419
+ onComplete?: algosdk.OnApplicationComplete | undefined;
420
+ rejectVersion?: number | undefined;
421
+ lease?: (Uint8Array | string) | undefined;
422
+ rekeyTo?: (string | Address) | undefined;
423
+ staticFee?: AlgoAmount | undefined;
424
+ extraFee?: AlgoAmount | undefined;
425
+ validityWindow?: number | bigint | undefined;
426
+ firstValidRound?: bigint | undefined;
427
+ lastValidRound?: bigint | undefined;
428
+ accountReferences?: (string | Address)[] | undefined;
429
+ appReferences?: bigint[] | undefined;
430
+ assetReferences?: bigint[] | undefined;
431
+ boxReferences?: (import("./app-manager").BoxReference | BoxIdentifier)[];
432
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
433
+ sender?: (Address | string) | undefined;
434
+ method: string;
435
+ args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[];
436
+ /** Any deploy-time parameters to replace in the TEAL code */
437
+ deployTimeParams?: TealTemplateParams;
438
+ /** Whether or not the contract should have deploy-time immutability control set, undefined = ignore */
439
+ updatable?: boolean;
440
+ /** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
441
+ deletable?: boolean;
442
+ } & {
443
+ appId: bigint;
444
+ sender: algosdk.Address;
445
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
446
+ method: Arc56Method;
447
+ onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
448
+ args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
449
+ sender: string | Address;
450
+ maxFee?: AlgoAmount | undefined;
451
+ note?: (Uint8Array | string) | undefined;
452
+ args?: Uint8Array[] | undefined;
453
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
454
+ onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
455
+ rejectVersion?: number | undefined;
456
+ lease?: (Uint8Array | string) | undefined;
457
+ rekeyTo?: (string | Address) | undefined;
458
+ staticFee?: AlgoAmount | undefined;
459
+ extraFee?: AlgoAmount | undefined;
460
+ validityWindow?: number | bigint | undefined;
461
+ firstValidRound?: bigint | undefined;
462
+ lastValidRound?: bigint | undefined;
463
+ accountReferences?: (string | Address)[] | undefined;
464
+ appReferences?: bigint[] | undefined;
465
+ assetReferences?: bigint[] | undefined;
466
+ boxReferences?: (import("./app-manager").BoxReference | BoxIdentifier)[] | undefined;
467
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
468
+ approvalProgram: string | Uint8Array;
469
+ clearStateProgram: string | Uint8Array;
470
+ schema?: {
471
+ globalInts: number;
472
+ globalByteSlices: number;
473
+ localInts: number;
474
+ localByteSlices: number;
475
+ } | undefined;
476
+ extraProgramPages?: number | undefined;
477
+ }> | AppMethodCall<{
478
+ sender: string | Address;
479
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
480
+ rekeyTo?: (string | Address) | undefined;
481
+ note?: (Uint8Array | string) | undefined;
482
+ lease?: (Uint8Array | string) | undefined;
483
+ staticFee?: AlgoAmount | undefined;
484
+ extraFee?: AlgoAmount | undefined;
485
+ maxFee?: AlgoAmount | undefined;
486
+ validityWindow?: number | bigint | undefined;
487
+ firstValidRound?: bigint | undefined;
488
+ lastValidRound?: bigint | undefined;
489
+ appId: bigint;
490
+ onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
491
+ args?: Uint8Array[] | undefined;
492
+ accountReferences?: (string | Address)[] | undefined;
493
+ appReferences?: bigint[] | undefined;
494
+ assetReferences?: bigint[] | undefined;
495
+ boxReferences?: (import("./app-manager").BoxReference | BoxIdentifier)[] | undefined;
496
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
497
+ rejectVersion?: number | undefined;
498
+ approvalProgram: string | Uint8Array;
499
+ clearStateProgram: string | Uint8Array;
500
+ }> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
501
+ }>;
502
+ /**
503
+ * Return params for an opt-in ABI call
504
+ * @param params The parameters for the opt-in ABI method call
505
+ * @returns The parameters which can be used to create an opt-in ABI method call
506
+ */
507
+ optIn: (params: AppClientMethodCallParams) => Promise<AppCallMethodCall>;
508
+ /**
509
+ * Return params for an delete ABI call
510
+ * @param params The parameters for the delete ABI method call
511
+ * @returns The parameters which can be used to create a delete ABI method call
512
+ */
513
+ delete: (params: AppClientMethodCallParams) => Promise<AppDeleteMethodCall>;
514
+ /** Return params for an close out ABI call
515
+ * @param params The parameters for the close out ABI method call
516
+ * @returns The parameters which can be used to create a close out ABI method call
517
+ */
518
+ closeOut: (params: AppClientMethodCallParams) => Promise<AppCallMethodCall>;
519
+ /** Return params for an ABI call
520
+ * @param params The parameters for the ABI method call
521
+ * @returns The parameters which can be used to create an ABI method call
522
+ */
523
+ call: (params: AppClientMethodCallParams & CallOnComplete) => Promise<AppCallMethodCall>;
524
+ } & {
525
+ /** Interact with bare (raw) call parameters */ bare: ReturnType<AppClient["getBareParamsMethods"]>;
526
+ };
527
+ /** Create transactions for the current app */
528
+ get createTransaction(): {
529
+ /** Return transaction for a payment transaction to fund the app account
530
+ * @param params The parameters for the fund app account payment transaction
531
+ * @returns A transaction which can be used to fund the app account
532
+ */
533
+ fundAppAccount: (params: FundAppParams) => Promise<algosdk.Transaction>;
534
+ /**
535
+ * Return transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
536
+ * @param params The parameters for the update ABI method call
537
+ * @returns The transactions which can be used to create an update ABI method call
538
+ */
539
+ update: (params: AppClientMethodCallParams & AppClientCompilationParams) => Promise<{
540
+ transactions: algosdk.Transaction[];
541
+ methodCalls: Map<number, algosdk.ABIMethod>;
542
+ signers: Map<number, algosdk.TransactionSigner>;
543
+ }>;
544
+ /**
545
+ * Return transactions for an opt-in ABI call
546
+ * @param params The parameters for the opt-in ABI method call
547
+ * @returns The transactions which can be used to create an opt-in ABI method call
548
+ */
549
+ optIn: (params: AppClientMethodCallParams) => Promise<{
550
+ transactions: algosdk.Transaction[];
551
+ methodCalls: Map<number, algosdk.ABIMethod>;
552
+ signers: Map<number, algosdk.TransactionSigner>;
553
+ }>;
554
+ /**
555
+ * Return transactions for a delete ABI call
556
+ * @param params The parameters for the delete ABI method call
557
+ * @returns The transactions which can be used to create a delete ABI method call
558
+ */
559
+ delete: (params: AppClientMethodCallParams) => Promise<{
560
+ transactions: algosdk.Transaction[];
561
+ methodCalls: Map<number, algosdk.ABIMethod>;
562
+ signers: Map<number, algosdk.TransactionSigner>;
563
+ }>;
564
+ /**
565
+ * Return transactions for a close out ABI call
566
+ * @param params The parameters for the close out ABI method call
567
+ * @returns The transactions which can be used to create a close out ABI method call
568
+ */
569
+ closeOut: (params: AppClientMethodCallParams) => Promise<{
570
+ transactions: algosdk.Transaction[];
571
+ methodCalls: Map<number, algosdk.ABIMethod>;
572
+ signers: Map<number, algosdk.TransactionSigner>;
573
+ }>;
574
+ /**
575
+ * Return transactions for an ABI call (defaults to no-op)
576
+ * @param params The parameters for the ABI method call
577
+ * @returns The transactions which can be used to create an ABI method call
578
+ */
579
+ call: (params: AppClientMethodCallParams & CallOnComplete) => Promise<{
580
+ transactions: algosdk.Transaction[];
581
+ methodCalls: Map<number, algosdk.ABIMethod>;
582
+ signers: Map<number, algosdk.TransactionSigner>;
583
+ }>;
584
+ } & {
585
+ /** Interact with bare (raw) call transactions */ bare: ReturnType<AppClient["getBareCreateTransactionMethods"]>;
586
+ };
587
+ /** Send transactions to the current app */
588
+ get send(): {
589
+ /** Sign and send transactions for a payment transaction to fund the app account
590
+ * @param params The parameters for the fund app account payment transaction
591
+ * @returns The result of send the fund app account payment transaction
592
+ */
593
+ fundAppAccount: (params: FundAppParams & SendParams) => Promise<{
594
+ groupId: string;
595
+ txIds: string[];
596
+ returns?: ABIReturn[] | undefined;
597
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
598
+ transactions: algosdk.Transaction[];
599
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
600
+ transaction: algosdk.Transaction;
601
+ }>;
602
+ /**
603
+ * Sign and send transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
604
+ * @param params The parameters for the update ABI method call
605
+ * @returns The result of sending the update ABI method call
606
+ */
607
+ update: (params: AppClientMethodCallParams & AppClientCompilationParams & SendParams) => Promise<{
608
+ compiledApproval?: import("./app").CompiledTeal | undefined;
609
+ compiledClear?: import("./app").CompiledTeal | undefined;
610
+ groupId: string;
611
+ txIds: string[];
612
+ returns?: ABIReturn[] | undefined;
613
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
614
+ transactions: algosdk.Transaction[];
615
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
616
+ transaction: algosdk.Transaction;
617
+ return?: Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined;
618
+ }>;
619
+ /**
620
+ * Sign and send transactions for an opt-in ABI call
621
+ * @param params The parameters for the opt-in ABI method call
622
+ * @returns The result of sending the opt-in ABI method call
623
+ */
624
+ optIn: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
625
+ groupId: string;
626
+ txIds: string[];
627
+ returns?: ABIReturn[] | undefined;
628
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
629
+ transactions: algosdk.Transaction[];
630
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
631
+ transaction: algosdk.Transaction;
632
+ return?: ABIReturn | undefined;
633
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
634
+ /**
635
+ * Sign and send transactions for a delete ABI call
636
+ * @param params The parameters for the delete ABI method call
637
+ * @returns The result of sending the delete ABI method call
638
+ */
639
+ delete: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
640
+ groupId: string;
641
+ txIds: string[];
642
+ returns?: ABIReturn[] | undefined;
643
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
644
+ transactions: algosdk.Transaction[];
645
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
646
+ transaction: algosdk.Transaction;
647
+ return?: ABIReturn | undefined;
648
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
649
+ /**
650
+ * Sign and send transactions for a close out ABI call
651
+ * @param params The parameters for the close out ABI method call
652
+ * @returns The result of sending the close out ABI method call
653
+ */
654
+ closeOut: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
655
+ groupId: string;
656
+ txIds: string[];
657
+ returns?: ABIReturn[] | undefined;
658
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
659
+ transactions: algosdk.Transaction[];
660
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
661
+ transaction: algosdk.Transaction;
662
+ return?: ABIReturn | undefined;
663
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
664
+ /**
665
+ * Sign and send transactions for a call (defaults to no-op)
666
+ * @param params The parameters for the ABI method call
667
+ * @returns The result of sending the ABI method call
668
+ */
669
+ call: (params: AppClientMethodCallParams & CallOnComplete & SendParams) => Promise<Omit<{
670
+ groupId: string;
671
+ txIds: string[];
672
+ returns?: ABIReturn[] | undefined;
673
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
674
+ transactions: algosdk.Transaction[];
675
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
676
+ transaction: algosdk.Transaction;
677
+ return?: ABIReturn | undefined;
678
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
679
+ } & {
680
+ /** Interact with bare (raw) calls */ bare: ReturnType<AppClient["getBareSendMethods"]>;
681
+ };
682
+ /** Get state (local, global, box) from the current app */
683
+ get state(): {
684
+ /**
685
+ * Methods to access local state for the current app
686
+ * @param address The address of the account to get the local state for
687
+ */
688
+ local: (address: string | Address) => ReturnType<AppClient["getStateMethods"]>;
689
+ /**
690
+ * Methods to access global state for the current app
691
+ */
692
+ global: {
693
+ /**
694
+ * Returns all single-key state values in a record keyed by the key name and the value a decoded ABI value.
695
+ */
696
+ getAll: () => Promise<Record<string, any>>;
697
+ /**
698
+ * Returns a single state value for the current app with the value a decoded ABI value.
699
+ * @param name The name of the state value to retrieve the value for
700
+ * @param appState Optional cached value of the current state
701
+ * @returns
702
+ */
703
+ getValue: (name: string, appState?: AppState) => Promise<algosdk.ABIValue | ABIStruct | undefined>;
704
+ /**
705
+ * Returns a single value from the given map for the current app with the value a decoded ABI value.
706
+ * @param mapName The name of the map to read from
707
+ * @param key The key within the map (without any map prefix) as either a Buffer with the bytes or a value
708
+ * that will be converted to bytes by encoding it using the specified ABI key type
709
+ * in the ARC-56 spec
710
+ * @param appState Optional cached value of the current state
711
+ */
712
+ getMapValue: (mapName: string, key: Uint8Array | any, appState?: AppState) => Promise<algosdk.ABIValue | ABIStruct | undefined>;
713
+ /**
714
+ * Returns all map values for the given map.
715
+ * @param mapName The name of the map to read from
716
+ * @param appState Optional cached value of the current state
717
+ * @returns A map of all key-value pairs in the map as a `Record<string, ABIValue>`
718
+ */
719
+ getMap: (mapName: string) => Promise<Map<algosdk.ABIValue | ABIStruct, algosdk.ABIValue | ABIStruct>>;
720
+ };
721
+ /**
722
+ * Methods to access box storage for the current app
723
+ */
724
+ box: {
725
+ /**
726
+ * Returns all single-key state values in a record keyed by the key name and the value a decoded ABI value.
727
+ */
728
+ getAll: () => Promise<Record<string, any>>;
729
+ /**
730
+ * Returns a single state value for the current app with the value a decoded ABI value.
731
+ * @param name The name of the state value to retrieve the value for
732
+ * @returns
733
+ */
734
+ getValue: (name: string) => Promise<algosdk.ABIValue | ABIStruct>;
735
+ /**
736
+ *
737
+ * @param mapName The name of the map to read from
738
+ * @param key The key within the map (without any map prefix) as either a Buffer with the bytes or a value
739
+ * that will be converted to bytes by encoding it using the specified ABI key type
740
+ * in the ARC-56 spec
741
+ */
742
+ getMapValue: (mapName: string, key: Uint8Array | any) => Promise<algosdk.ABIValue | ABIStruct>;
743
+ /**
744
+ *
745
+ * @param mapName The name of the map to read from
746
+ * @param key The key within the map as either a Buffer with the bytes or a value
747
+ * that will be converted to bytes by encoding it using the specified ABI key type
748
+ * in the ARC-56 spec
749
+ * @param appState
750
+ */
751
+ getMap: (mapName: string) => Promise<Map<algosdk.ABIValue | ABIStruct, algosdk.ABIValue | ABIStruct>>;
752
+ };
753
+ };
508
754
  /**
509
- * Return transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
510
- * @param params The parameters for the update ABI method call
511
- * @returns The transactions which can be used to create an update ABI method call
755
+ * Funds Algo into the app account for this app.
756
+ *
757
+ * An alias for `appClient.send.fundAppAccount(params)`.
758
+ * @param params The parameters for the funding transaction
759
+ * @returns The result of the funding
760
+ * @example
761
+ * ```typescript
762
+ * await appClient.fundAppAccount({ amount: algo(1) })
763
+ * ```
512
764
  */
513
- update: (params: AppClientMethodCallParams & AppClientCompilationParams) => Promise<{
514
- transactions: algosdk.Transaction[];
515
- methodCalls: Map<number, algosdk.ABIMethod>;
516
- signers: Map<number, algosdk.TransactionSigner>;
765
+ fundAppAccount(params: FundAppParams): Promise<{
766
+ groupId: string;
767
+ txIds: string[];
768
+ returns?: ABIReturn[] | undefined;
769
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
770
+ transactions: algosdk.Transaction[];
771
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
772
+ transaction: algosdk.Transaction;
517
773
  }>;
518
774
  /**
519
- * Return transactions for an opt-in ABI call
520
- * @param params The parameters for the opt-in ABI method call
521
- * @returns The transactions which can be used to create an opt-in ABI method call
775
+ * Returns raw global state for the current app.
776
+ * @returns The global state
777
+ * @example
778
+ * ```typescript
779
+ * const globalState = await appClient.getGlobalState()
780
+ * ```
522
781
  */
523
- optIn: (params: AppClientMethodCallParams) => Promise<{
524
- transactions: algosdk.Transaction[];
525
- methodCalls: Map<number, algosdk.ABIMethod>;
526
- signers: Map<number, algosdk.TransactionSigner>;
527
- }>;
782
+ getGlobalState(): Promise<AppState>;
528
783
  /**
529
- * Return transactions for a delete ABI call
530
- * @param params The parameters for the delete ABI method call
531
- * @returns The transactions which can be used to create a delete ABI method call
784
+ * Returns raw local state for the given account address.
785
+ * @param address The address of the account to get the local state for
786
+ * @returns The local state
787
+ * @example
788
+ * ```typescript
789
+ * const localState = await appClient.getLocalState('ACCOUNT_ADDRESS')
790
+ * ```
532
791
  */
533
- delete: (params: AppClientMethodCallParams) => Promise<{
534
- transactions: algosdk.Transaction[];
535
- methodCalls: Map<number, algosdk.ABIMethod>;
536
- signers: Map<number, algosdk.TransactionSigner>;
537
- }>;
792
+ getLocalState(address: Address | string): Promise<AppState>;
538
793
  /**
539
- * Return transactions for a close out ABI call
540
- * @param params The parameters for the close out ABI method call
541
- * @returns The transactions which can be used to create a close out ABI method call
794
+ * Returns the names of all current boxes for the current app.
795
+ * @returns The names of the boxes
796
+ * @example
797
+ * ```typescript
798
+ * const boxNames = await appClient.getBoxNames()
799
+ * ```
542
800
  */
543
- closeOut: (params: AppClientMethodCallParams) => Promise<{
544
- transactions: algosdk.Transaction[];
545
- methodCalls: Map<number, algosdk.ABIMethod>;
546
- signers: Map<number, algosdk.TransactionSigner>;
547
- }>;
801
+ getBoxNames(): Promise<BoxName[]>;
548
802
  /**
549
- * Return transactions for an ABI call (defaults to no-op)
550
- * @param params The parameters for the ABI method call
551
- * @returns The transactions which can be used to create an ABI method call
803
+ * Returns the value of the given box for the current app.
804
+ * @param name The identifier of the box to return
805
+ * @returns The current box value as a byte array
806
+ * @example
807
+ * ```typescript
808
+ * const boxValue = await appClient.getBoxValue('boxName')
809
+ * ```
552
810
  */
553
- call: (params: AppClientMethodCallParams & CallOnComplete) => Promise<{
554
- transactions: algosdk.Transaction[];
555
- methodCalls: Map<number, algosdk.ABIMethod>;
556
- signers: Map<number, algosdk.TransactionSigner>;
557
- }>;
558
- } & {
559
- /** Interact with bare (raw) call transactions */bare: ReturnType<AppClient["getBareCreateTransactionMethods"]>;
560
- };
561
- /** Send transactions to the current app */
562
- get send(): {
563
- /** Sign and send transactions for a payment transaction to fund the app account
564
- * @param params The parameters for the fund app account payment transaction
565
- * @returns The result of send the fund app account payment transaction
811
+ getBoxValue(name: BoxIdentifier): Promise<Uint8Array>;
812
+ /**
813
+ * Returns the value of the given box for the current app.
814
+ * @param name The identifier of the box to return
815
+ * @param type
816
+ * @returns The current box value as a byte array
817
+ * @example
818
+ * ```typescript
819
+ * const boxValue = await appClient.getBoxValueFromABIType('boxName', new ABIUintType(32))
820
+ * ```
566
821
  */
567
- fundAppAccount: (params: FundAppParams & SendParams) => Promise<{
568
- groupId: string;
569
- txIds: string[];
570
- returns?: ABIReturn[] | undefined;
571
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
572
- transactions: algosdk.Transaction[];
573
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
574
- transaction: algosdk.Transaction;
575
- }>;
822
+ getBoxValueFromABIType(name: BoxIdentifier, type: ABIType): Promise<ABIValue>;
576
823
  /**
577
- * Sign and send transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
578
- * @param params The parameters for the update ABI method call
579
- * @returns The result of sending the update ABI method call
824
+ * Returns the values of all current boxes for the current app.
825
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
826
+ * @param filter Optional filter to filter which boxes' values are returned
827
+ * @returns The (name, value) pair of the boxes with values as raw byte arrays
828
+ * @example
829
+ * ```typescript
830
+ * const boxValues = await appClient.getBoxValues()
831
+ * ```
580
832
  */
581
- update: (params: AppClientMethodCallParams & AppClientCompilationParams & SendParams) => Promise<{
582
- compiledApproval?: CompiledTeal | undefined;
583
- compiledClear?: CompiledTeal | undefined;
584
- groupId: string;
585
- txIds: string[];
586
- returns?: ABIReturn[] | undefined;
587
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
588
- transactions: algosdk.Transaction[];
589
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
590
- transaction: algosdk.Transaction;
591
- return?: Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined;
592
- }>;
833
+ getBoxValues(filter?: (name: BoxName) => boolean): Promise<{
834
+ name: BoxName;
835
+ value: Uint8Array;
836
+ }[]>;
593
837
  /**
594
- * Sign and send transactions for an opt-in ABI call
595
- * @param params The parameters for the opt-in ABI method call
596
- * @returns The result of sending the opt-in ABI method call
838
+ * Returns the values of all current boxes for the current app decoded using an ABI Type.
839
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
840
+ * @param type The ABI type to decode the values with
841
+ * @param filter Optional filter to filter which boxes' values are returned
842
+ * @returns The (name, value) pair of the boxes with values as the ABI Value
843
+ * @example
844
+ * ```typescript
845
+ * const boxValues = await appClient.getBoxValuesFromABIType(new ABIUintType(32))
846
+ * ```
597
847
  */
598
- optIn: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
599
- groupId: string;
600
- txIds: string[];
601
- returns?: ABIReturn[] | undefined;
602
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
603
- transactions: algosdk.Transaction[];
604
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
605
- transaction: algosdk.Transaction;
606
- return?: ABIReturn | undefined;
607
- }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
848
+ getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
849
+ name: BoxName;
850
+ value: ABIValue;
851
+ }[]>;
608
852
  /**
609
- * Sign and send transactions for a delete ABI call
610
- * @param params The parameters for the delete ABI method call
611
- * @returns The result of sending the delete ABI method call
853
+ * Takes an error that may include a logic error from a call to the current app and re-exposes the
854
+ * error to include source code information via the source map and ARC-56 spec.
855
+ * @param e The error to parse
856
+ * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)
857
+ * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
612
858
  */
613
- delete: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
614
- groupId: string;
615
- txIds: string[];
616
- returns?: ABIReturn[] | undefined;
617
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
618
- transactions: algosdk.Transaction[];
619
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
620
- transaction: algosdk.Transaction;
621
- return?: ABIReturn | undefined;
622
- }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
859
+ exposeLogicError(e: Error, isClearStateProgram?: boolean): Promise<Error>;
623
860
  /**
624
- * Sign and send transactions for a close out ABI call
625
- * @param params The parameters for the close out ABI method call
626
- * @returns The result of sending the close out ABI method call
861
+ * Export the current source maps for the app.
862
+ * @returns The source maps
627
863
  */
628
- closeOut: (params: AppClientMethodCallParams & SendParams) => Promise<Omit<{
629
- groupId: string;
630
- txIds: string[];
631
- returns?: ABIReturn[] | undefined;
632
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
633
- transactions: algosdk.Transaction[];
634
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
635
- transaction: algosdk.Transaction;
636
- return?: ABIReturn | undefined;
637
- }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
864
+ exportSourceMaps(): AppSourceMaps;
638
865
  /**
639
- * Sign and send transactions for a call (defaults to no-op)
640
- * @param params The parameters for the ABI method call
641
- * @returns The result of sending the ABI method call
866
+ * Import source maps for the app.
867
+ * @param sourceMaps The source maps to import
642
868
  */
643
- call: (params: AppClientMethodCallParams & CallOnComplete & SendParams) => Promise<Omit<{
644
- groupId: string;
645
- txIds: string[];
646
- returns?: ABIReturn[] | undefined;
647
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
648
- transactions: algosdk.Transaction[];
649
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
650
- transaction: algosdk.Transaction;
651
- return?: ABIReturn | undefined;
652
- }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
653
- } & {
654
- /** Interact with bare (raw) calls */bare: ReturnType<AppClient["getBareSendMethods"]>;
655
- };
656
- /** Get state (local, global, box) from the current app */
657
- get state(): {
869
+ importSourceMaps(sourceMaps: AppSourceMaps): void;
658
870
  /**
659
- * Methods to access local state for the current app
660
- * @param address The address of the account to get the local state for
871
+ * Returns the ABI Method spec for the given method string for the app represented by this application client instance
872
+ * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
873
+ * e.g. `my_method` or `my_method(unit64,string)bytes`
874
+ * @returns A tuple with: [ARC-56 `Method`, algosdk `ABIMethod`]
661
875
  */
662
- local: (address: string | Address) => ReturnType<AppClient["getStateMethods"]>;
876
+ getABIMethod(methodNameOrSignature: string): Arc56Method;
663
877
  /**
664
- * Methods to access global state for the current app
878
+ * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
879
+ * on the ARC-56 method, replacing the `return` property with the decoded type.
880
+ *
881
+ * If the return type is an ARC-56 struct then the struct will be returned.
882
+ *
883
+ * @param result The SendAppTransactionResult to be mapped
884
+ * @param method The method that was called
885
+ * @returns The smart contract response with an updated return value
665
886
  */
666
- global: {
667
- /**
668
- * Returns all single-key state values in a record keyed by the key name and the value a decoded ABI value.
669
- */
670
- getAll: () => Promise<Record<string, any>>;
671
- /**
672
- * Returns a single state value for the current app with the value a decoded ABI value.
673
- * @param name The name of the state value to retrieve the value for
674
- * @param appState Optional cached value of the current state
675
- * @returns
676
- */
677
- getValue: (name: string, appState?: AppState) => Promise<algosdk.ABIValue | ABIStruct | undefined>;
678
- /**
679
- * Returns a single value from the given map for the current app with the value a decoded ABI value.
680
- * @param mapName The name of the map to read from
681
- * @param key The key within the map (without any map prefix) as either a Buffer with the bytes or a value
682
- * that will be converted to bytes by encoding it using the specified ABI key type
683
- * in the ARC-56 spec
684
- * @param appState Optional cached value of the current state
685
- */
686
- getMapValue: (mapName: string, key: Uint8Array | any, appState?: AppState) => Promise<algosdk.ABIValue | ABIStruct | undefined>;
687
- /**
688
- * Returns all map values for the given map.
689
- * @param mapName The name of the map to read from
690
- * @param appState Optional cached value of the current state
691
- * @returns A map of all key-value pairs in the map as a `Record<string, ABIValue>`
692
- */
693
- getMap: (mapName: string) => Promise<Map<algosdk.ABIValue | ABIStruct, algosdk.ABIValue | ABIStruct>>;
694
- };
887
+ processMethodCallReturn<TReturn extends Uint8Array | ABIValue | ABIStruct | undefined, TResult extends SendAppTransactionResult = SendAppTransactionResult>(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>>;
695
888
  /**
696
- * Methods to access box storage for the current app
889
+ * Compiles the approval and clear state programs (if TEAL templates provided),
890
+ * performing any provided deploy-time parameter replacement and stores
891
+ * the source maps.
892
+ *
893
+ * If no TEAL templates provided it will use any byte code provided in the app spec.
894
+ *
895
+ * Will store any generated source maps for later use in debugging.
896
+ * @param compilation Any compilation parameters to use
897
+ * @returns The compiled code and any compilation results (including source maps)
697
898
  */
698
- box: {
699
- /**
700
- * Returns all single-key state values in a record keyed by the key name and the value a decoded ABI value.
701
- */
702
- getAll: () => Promise<Record<string, any>>;
703
- /**
704
- * Returns a single state value for the current app with the value a decoded ABI value.
705
- * @param name The name of the state value to retrieve the value for
706
- * @returns
707
- */
708
- getValue: (name: string) => Promise<algosdk.ABIValue | ABIStruct>;
709
- /**
710
- *
711
- * @param mapName The name of the map to read from
712
- * @param key The key within the map (without any map prefix) as either a Buffer with the bytes or a value
713
- * that will be converted to bytes by encoding it using the specified ABI key type
714
- * in the ARC-56 spec
715
- */
716
- getMapValue: (mapName: string, key: Uint8Array | any) => Promise<algosdk.ABIValue | ABIStruct>;
717
- /**
718
- *
719
- * @param mapName The name of the map to read from
720
- * @param key The key within the map as either a Buffer with the bytes or a value
721
- * that will be converted to bytes by encoding it using the specified ABI key type
722
- * in the ARC-56 spec
723
- * @param appState
724
- */
725
- getMap: (mapName: string) => Promise<Map<algosdk.ABIValue | ABIStruct, algosdk.ABIValue | ABIStruct>>;
726
- };
727
- };
728
- /**
729
- * Funds Algo into the app account for this app.
730
- *
731
- * An alias for `appClient.send.fundAppAccount(params)`.
732
- * @param params The parameters for the funding transaction
733
- * @returns The result of the funding
734
- * @example
735
- * ```typescript
736
- * await appClient.fundAppAccount({ amount: algo(1) })
737
- * ```
738
- */
739
- fundAppAccount(params: FundAppParams): Promise<{
740
- groupId: string;
741
- txIds: string[];
742
- returns?: ABIReturn[] | undefined;
743
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
744
- transactions: algosdk.Transaction[];
745
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
746
- transaction: algosdk.Transaction;
747
- }>;
748
- /**
749
- * Returns raw global state for the current app.
750
- * @returns The global state
751
- * @example
752
- * ```typescript
753
- * const globalState = await appClient.getGlobalState()
754
- * ```
755
- */
756
- getGlobalState(): Promise<AppState>;
757
- /**
758
- * Returns raw local state for the given account address.
759
- * @param address The address of the account to get the local state for
760
- * @returns The local state
761
- * @example
762
- * ```typescript
763
- * const localState = await appClient.getLocalState('ACCOUNT_ADDRESS')
764
- * ```
765
- */
766
- getLocalState(address: Address | string): Promise<AppState>;
767
- /**
768
- * Returns the names of all current boxes for the current app.
769
- * @returns The names of the boxes
770
- * @example
771
- * ```typescript
772
- * const boxNames = await appClient.getBoxNames()
773
- * ```
774
- */
775
- getBoxNames(): Promise<BoxName[]>;
776
- /**
777
- * Returns the value of the given box for the current app.
778
- * @param name The identifier of the box to return
779
- * @returns The current box value as a byte array
780
- * @example
781
- * ```typescript
782
- * const boxValue = await appClient.getBoxValue('boxName')
783
- * ```
784
- */
785
- getBoxValue(name: BoxIdentifier): Promise<Uint8Array>;
786
- /**
787
- * Returns the value of the given box for the current app.
788
- * @param name The identifier of the box to return
789
- * @param type
790
- * @returns The current box value as a byte array
791
- * @example
792
- * ```typescript
793
- * const boxValue = await appClient.getBoxValueFromABIType('boxName', new ABIUintType(32))
794
- * ```
795
- */
796
- getBoxValueFromABIType(name: BoxIdentifier, type: ABIType): Promise<ABIValue>;
797
- /**
798
- * Returns the values of all current boxes for the current app.
799
- * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
800
- * @param filter Optional filter to filter which boxes' values are returned
801
- * @returns The (name, value) pair of the boxes with values as raw byte arrays
802
- * @example
803
- * ```typescript
804
- * const boxValues = await appClient.getBoxValues()
805
- * ```
806
- */
807
- getBoxValues(filter?: (name: BoxName) => boolean): Promise<{
808
- name: BoxName;
809
- value: Uint8Array;
810
- }[]>;
811
- /**
812
- * Returns the values of all current boxes for the current app decoded using an ABI Type.
813
- * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
814
- * @param type The ABI type to decode the values with
815
- * @param filter Optional filter to filter which boxes' values are returned
816
- * @returns The (name, value) pair of the boxes with values as the ABI Value
817
- * @example
818
- * ```typescript
819
- * const boxValues = await appClient.getBoxValuesFromABIType(new ABIUintType(32))
820
- * ```
821
- */
822
- getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
823
- name: BoxName;
824
- value: ABIValue;
825
- }[]>;
826
- /**
827
- * Takes an error that may include a logic error from a call to the current app and re-exposes the
828
- * error to include source code information via the source map and ARC-56 spec.
829
- * @param e The error to parse
830
- * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)
831
- * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
832
- */
833
- exposeLogicError(e: Error, isClearStateProgram?: boolean): Promise<Error>;
834
- /**
835
- * Export the current source maps for the app.
836
- * @returns The source maps
837
- */
838
- exportSourceMaps(): AppSourceMaps;
839
- /**
840
- * Import source maps for the app.
841
- * @param sourceMaps The source maps to import
842
- */
843
- importSourceMaps(sourceMaps: AppSourceMaps): void;
844
- /**
845
- * Returns the ABI Method spec for the given method string for the app represented by this application client instance
846
- * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
847
- * e.g. `my_method` or `my_method(unit64,string)bytes`
848
- * @returns A tuple with: [ARC-56 `Method`, algosdk `ABIMethod`]
849
- */
850
- getABIMethod(methodNameOrSignature: string): Arc56Method;
851
- /**
852
- * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
853
- * on the ARC-56 method, replacing the `return` property with the decoded type.
854
- *
855
- * If the return type is an ARC-56 struct then the struct will be returned.
856
- *
857
- * @param result The SendAppTransactionResult to be mapped
858
- * @param method The method that was called
859
- * @returns The smart contract response with an updated return value
860
- */
861
- processMethodCallReturn<TReturn extends Uint8Array | ABIValue | ABIStruct | undefined, TResult extends SendAppTransactionResult = SendAppTransactionResult>(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>>;
862
- /**
863
- * Compiles the approval and clear state programs (if TEAL templates provided),
864
- * performing any provided deploy-time parameter replacement and stores
865
- * the source maps.
866
- *
867
- * If no TEAL templates provided it will use any byte code provided in the app spec.
868
- *
869
- * Will store any generated source maps for later use in debugging.
870
- * @param compilation Any compilation parameters to use
871
- * @returns The compiled code and any compilation results (including source maps)
872
- */
873
- compile(compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
874
- /**
875
- * Takes an error that may include a logic error from a call to the current app and re-exposes the
876
- * error to include source code information via the source map and ARC-56 spec.
877
- * @param e The error to parse
878
- * @param appSpec The app spec for the app
879
- * @param details Additional information to inform the error
880
- * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
881
- */
882
- static exposeLogicError(e: Error, appSpec: Arc56Contract, details: {
883
- /** Whether or not the code was running the clear state program (defaults to approval program) */isClearStateProgram?: boolean; /** Approval program source map */
884
- approvalSourceMap?: SourceMap; /** Clear state program source map */
885
- clearSourceMap?: SourceMap; /** program bytes */
886
- program?: Uint8Array; /** ARC56 approval source info */
887
- approvalSourceInfo?: ProgramSourceInfo; /** ARC56 clear source info */
888
- clearSourceInfo?: ProgramSourceInfo;
889
- }): Error;
890
- /**
891
- * Compiles the approval and clear state programs (if TEAL templates provided),
892
- * performing any provided deploy-time parameter replacement and returns
893
- * the compiled code and any compilation results (including source maps).
894
- *
895
- * If no TEAL templates provided it will use any byte code provided in the app spec.
896
- *
897
- * Will store any generated source maps for later use in debugging.
898
- * @param appSpec The app spec for the app
899
- * @param appManager The app manager to use for compilation
900
- * @param compilation Any compilation parameters to use
901
- * @returns The compiled code and any compilation results (including source maps)
902
- */
903
- static compile(appSpec: Arc56Contract, appManager: AppManager, compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
904
- /**
905
- * Returns ABI method arguments ready for a method call params object with default values populated
906
- * and structs replaced with tuples.
907
- *
908
- * It does this by replacing any `undefined` values with the equivalent default value from the given ARC-56 app spec.
909
- * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
910
- * e.g. `my_method` or `my_method(unit64,string)bytes`
911
- * @param args The arguments to the method with `undefined` for any that should be populated with a default value
912
- */
913
- private getABIArgsWithDefaultValues;
914
- private getBareParamsMethods;
915
- private getBareCreateTransactionMethods;
916
- private getBareSendMethods;
917
- private getMethodCallParamsMethods;
918
- private getMethodCallSendMethods;
919
- private getMethodCallCreateTransactionMethods;
920
- /** Returns the sender for a call, using the provided sender or using the `defaultSender`
921
- * if none provided and throws an error if neither provided */
922
- private getSender;
923
- /** Returns the signer for a call, using the provided signer or the `defaultSigner`
924
- * if no signer was provided and the sender resolves to the default sender, the call will use default signer
925
- * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
926
- private getSigner;
927
- private getBareParams;
928
- private getABIParams;
929
- /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
930
- private handleCallErrors;
931
- private getBoxMethods;
932
- private getStateMethods;
899
+ compile(compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
900
+ /**
901
+ * Takes an error that may include a logic error from a call to the current app and re-exposes the
902
+ * error to include source code information via the source map and ARC-56 spec.
903
+ * @param e The error to parse
904
+ * @param appSpec The app spec for the app
905
+ * @param details Additional information to inform the error
906
+ * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
907
+ */
908
+ static exposeLogicError(e: Error, appSpec: Arc56Contract, details: {
909
+ /** Whether or not the code was running the clear state program (defaults to approval program) */ isClearStateProgram?: boolean;
910
+ /** Approval program source map */ approvalSourceMap?: SourceMap;
911
+ /** Clear state program source map */ clearSourceMap?: SourceMap;
912
+ /** program bytes */ program?: Uint8Array;
913
+ /** ARC56 approval source info */ approvalSourceInfo?: ProgramSourceInfo;
914
+ /** ARC56 clear source info */ clearSourceInfo?: ProgramSourceInfo;
915
+ }): Error;
916
+ /**
917
+ * Compiles the approval and clear state programs (if TEAL templates provided),
918
+ * performing any provided deploy-time parameter replacement and returns
919
+ * the compiled code and any compilation results (including source maps).
920
+ *
921
+ * If no TEAL templates provided it will use any byte code provided in the app spec.
922
+ *
923
+ * Will store any generated source maps for later use in debugging.
924
+ * @param appSpec The app spec for the app
925
+ * @param appManager The app manager to use for compilation
926
+ * @param compilation Any compilation parameters to use
927
+ * @returns The compiled code and any compilation results (including source maps)
928
+ */
929
+ static compile(appSpec: Arc56Contract, appManager: AppManager, compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
930
+ /**
931
+ * Returns ABI method arguments ready for a method call params object with default values populated
932
+ * and structs replaced with tuples.
933
+ *
934
+ * It does this by replacing any `undefined` values with the equivalent default value from the given ARC-56 app spec.
935
+ * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
936
+ * e.g. `my_method` or `my_method(unit64,string)bytes`
937
+ * @param args The arguments to the method with `undefined` for any that should be populated with a default value
938
+ */
939
+ private getABIArgsWithDefaultValues;
940
+ private getBareParamsMethods;
941
+ private getBareCreateTransactionMethods;
942
+ private getBareSendMethods;
943
+ private getMethodCallParamsMethods;
944
+ private getMethodCallSendMethods;
945
+ private getMethodCallCreateTransactionMethods;
946
+ /** Returns the sender for a call, using the provided sender or using the `defaultSender`
947
+ * if none provided and throws an error if neither provided */
948
+ private getSender;
949
+ /** Returns the signer for a call, using the provided signer or the `defaultSigner`
950
+ * if no signer was provided and the sender resolves to the default sender, the call will use default signer
951
+ * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
952
+ private getSigner;
953
+ private getBareParams;
954
+ private getABIParams;
955
+ /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
956
+ private handleCallErrors;
957
+ private getBoxMethods;
958
+ private getStateMethods;
933
959
  }
934
960
  /**
935
961
  * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or
@@ -938,298 +964,295 @@ declare class AppClient {
938
964
  * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.
939
965
  *
940
966
  * Application client - a class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app */
941
- declare class ApplicationClient {
942
- private algod;
943
- private indexer?;
944
- private appSpec;
945
- private sender;
946
- private params;
947
- private existingDeployments;
948
- private deployTimeParams?;
949
- private _appId;
950
- private _appAddress;
951
- private _creator;
952
- private _appName;
953
- private _approvalSourceMap;
954
- private _clearSourceMap;
955
- /**
956
- * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or
957
- * `algorand.client.getAppClientByCreatorAndName`.
958
- * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,
959
- * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.
960
- *
961
- * Create a new ApplicationClient instance
962
- * @param appDetails The details of the app
963
- * @param algod An algod instance
964
- */
965
- constructor(appDetails: AppSpecAppDetails, algod: Algodv2);
966
- /**
967
- * @deprecated Use `AppClient.compile()` instead.
968
- *
969
- * Compiles the approval and clear state programs and sets up the source map.
970
- * @param compilation The deploy-time parameters for the compilation
971
- * @returns The compiled approval and clear state programs
972
- */
973
- compile(compilation?: AppClientCompilationParams): Promise<{
974
- approvalCompiled: CompiledTeal;
975
- clearCompiled: CompiledTeal;
976
- }>;
977
- /**
978
- * Export the current source maps for the app.
979
- * @returns The source maps
980
- */
981
- exportSourceMaps(): AppSourceMaps;
982
- /**
983
- * Import source maps for the app.
984
- * @param sourceMaps The source maps to import
985
- */
986
- importSourceMaps(sourceMaps: AppSourceMaps): void;
987
- /**
988
- * @deprecated Use `deploy` from an `AppFactory` instance instead.
989
- *
990
- * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
991
- *
992
- * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/src/content/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
993
- *
994
- * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.
995
- *
996
- * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.
997
- * @param deploy Deployment details
998
- * @returns The metadata and transaction result(s) of the deployment, or just the metadata if it didn't need to issue transactions
999
- */
1000
- deploy(deploy?: AppClientDeployParams): Promise<(Partial<AppCompilationResult> & AppMetadata & {
1001
- operationPerformed: "nothing";
1002
- }) | {
1003
- compiledApproval: CompiledTeal;
1004
- compiledClear: CompiledTeal;
1005
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
1006
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1007
- transaction: algosdk.Transaction;
1008
- transactions: algosdk.Transaction[];
1009
- createdRound: number;
1010
- updatedRound: number;
1011
- createdMetadata: AppDeployMetadata;
1012
- deleted: boolean;
1013
- appId: number | bigint;
1014
- appAddress: string;
1015
- name: string;
1016
- version: string;
1017
- deletable?: boolean;
1018
- updatable?: boolean;
1019
- return?: ABIReturn;
1020
- operationPerformed: "create" | "update";
1021
- } | {
1022
- compiledApproval: CompiledTeal;
1023
- compiledClear: CompiledTeal;
1024
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
1025
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1026
- transaction: algosdk.Transaction;
1027
- transactions: algosdk.Transaction[];
1028
- createdRound: number;
1029
- updatedRound: number;
1030
- createdMetadata: AppDeployMetadata;
1031
- deleted: boolean;
1032
- appId: number | bigint;
1033
- appAddress: string;
1034
- name: string;
1035
- version: string;
1036
- deletable?: boolean;
1037
- updatable?: boolean;
1038
- return?: ABIReturn;
1039
- deleteReturn?: ABIReturn;
1040
- deleteResult: ConfirmedTransactionResult;
1041
- operationPerformed: "replace";
1042
- }>;
1043
- /**
1044
- * @deprecated Use `create` from an `AppFactory` instance instead.
1045
- *
1046
- * Creates a smart contract app, returns the details of the created app.
1047
- * @param create The parameters to create the app with
1048
- * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result
1049
- */
1050
- create(create?: AppClientCreateParams): Promise<{
1051
- compiledApproval: CompiledTeal;
1052
- compiledClear: CompiledTeal;
1053
- return?: ABIReturn | undefined;
1054
- transactions: algosdk.Transaction[];
1055
- confirmations?: algosdk.modelsv2.PendingTransactionResponse[];
1056
- transaction: algosdk.Transaction;
1057
- confirmation?: algosdk.modelsv2.PendingTransactionResponse;
1058
- appId: number | bigint;
1059
- appAddress: string;
1060
- }>;
1061
- /**
1062
- * @deprecated Use `appClient.send.update` or `appClient.createTransaction.update` from an `AppClient` instance instead.
1063
- *
1064
- * Updates the smart contract app.
1065
- * @param update The parameters to update the app with
1066
- * @returns The transaction send result and the compilation result
1067
- */
1068
- update(update?: AppClientUpdateParams): Promise<{
1069
- compiledApproval: CompiledTeal;
1070
- compiledClear: CompiledTeal;
1071
- return?: ABIReturn | undefined;
1072
- transactions: algosdk.Transaction[];
1073
- confirmations?: algosdk.modelsv2.PendingTransactionResponse[];
1074
- transaction: algosdk.Transaction;
1075
- confirmation?: algosdk.modelsv2.PendingTransactionResponse;
1076
- }>;
1077
- /**
1078
- * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1079
- *
1080
- * Issues a no_op (normal) call to the app.
1081
- * @param call The call details.
1082
- * @returns The result of the call
1083
- */
1084
- call(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1085
- /**
1086
- * @deprecated Use `appClient.send.optIn` or `appClient.createTransaction.optIn` from an `AppClient` instance instead.
1087
- *
1088
- * Issues a opt_in call to the app.
1089
- * @param call The call details.
1090
- * @returns The result of the call
1091
- */
1092
- optIn(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1093
- /**
1094
- * @deprecated Use `appClient.send.closeOut` or `appClient.createTransaction.closeOut` from an `AppClient` instance instead.
1095
- *
1096
- * Issues a close_out call to the app.
1097
- * @param call The call details.
1098
- * @returns The result of the call
1099
- */
1100
- closeOut(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1101
- /**
1102
- * @deprecated Use `appClient.send.clearState` or `appClient.createTransaction.clearState` from an `AppClient` instance instead.
1103
- *
1104
- * Issues a clear_state call to the app.
1105
- * @param call The call details.
1106
- * @returns The result of the call
1107
- */
1108
- clearState(call?: AppClientClearStateParams): Promise<AppCallTransactionResult>;
1109
- /**
1110
- * @deprecated Use `appClient.send.delete` or `appClient.createTransaction.delete` from an `AppClient` instance instead.
1111
- *
1112
- * Issues a delete_application call to the app.
1113
- * @param call The call details.
1114
- * @returns The result of the call
1115
- */
1116
- delete(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1117
- /**
1118
- * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1119
- *
1120
- * Issues a call to the app with the given call type.
1121
- * @param call The call details.
1122
- * @param callType The call type
1123
- * @returns The result of the call
1124
- */
1125
- callOfType(call: AppClientCallParams | undefined, callType: Exclude<AppCallType, 'update_application'> | Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>): Promise<AppCallTransactionResult>;
1126
- /**
1127
- * Funds Algo into the app account for this app.
1128
- * @param fund The parameters for the funding or the funding amount
1129
- * @returns The result of the funding
1130
- */
1131
- fundAppAccount(fund: FundAppAccountParams | AlgoAmount): Promise<(SendTransactionResult | {
1132
- groupId: string;
1133
- txIds: string[];
1134
- returns?: ABIReturn[] | undefined;
1135
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1136
- transactions: algosdk.Transaction[];
1137
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
1138
- transaction: algosdk.Transaction;
1139
- }) & {
1140
- transactions: algosdk.Transaction[];
1141
- }>;
1142
- /**
1143
- * Returns global state for the current app.
1144
- * @returns The global state
1145
- */
1146
- getGlobalState(): Promise<AppState>;
1147
- /**
1148
- * Returns local state for the given account / account address.
1149
- * @returns The global state
1150
- */
1151
- getLocalState(account: string | SendTransactionFrom): Promise<AppState>;
1152
- /**
1153
- * Returns the names of all current boxes for the current app.
1154
- * @returns The names of the boxes
1155
- */
1156
- getBoxNames(): Promise<BoxName[]>;
1157
- /**
1158
- * Returns the value of the given box for the current app.
1159
- * @param name The name of the box to return either as a string, binary array or `BoxName`
1160
- * @returns The current box value as a byte array
1161
- */
1162
- getBoxValue(name: BoxName | string | Uint8Array): Promise<Uint8Array>;
1163
- /**
1164
- * Returns the value of the given box for the current app.
1165
- * @param name The name of the box to return either as a string, binary array or `BoxName`
1166
- * @param type
1167
- * @returns The current box value as a byte array
1168
- */
1169
- getBoxValueFromABIType(name: BoxName | string | Uint8Array, type: ABIType): Promise<ABIValue>;
1170
- /**
1171
- * Returns the values of all current boxes for the current app.
1172
- * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
1173
- * @param filter Optional filter to filter which boxes' values are returned
1174
- * @returns The (name, value) pair of the boxes with values as raw byte arrays
1175
- */
1176
- getBoxValues(filter?: (name: BoxName) => boolean): Promise<{
1177
- name: BoxName;
1178
- value: Uint8Array;
1179
- }[]>;
1180
- /**
1181
- * Returns the values of all current boxes for the current app decoded using an ABI Type.
1182
- * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
1183
- * @param type The ABI type to decode the values with
1184
- * @param filter Optional filter to filter which boxes' values are returned
1185
- * @returns The (name, value) pair of the boxes with values as the ABI Value
1186
- */
1187
- getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
1188
- name: BoxName;
1189
- value: ABIValue;
1190
- }[]>;
1191
- /**
1192
- * @deprecated Use `appClient.params.*` from an `AppClient` instance instead.
1193
- *
1194
- * Returns the arguments for an app call for the given ABI method or raw method specification.
1195
- * @param args The call args specific to this application client
1196
- * @param sender The sender of this call. Will be used to fetch any default argument values if applicable
1197
- * @returns The call args ready to pass into an app call
1198
- */
1199
- getCallArgs(args: AppClientCallArgs | undefined, sender: SendTransactionFrom): Promise<AppCallArgs | undefined>;
1200
- /**
1201
- * @deprecated Use `appClient.getABIMethod` instead.
1202
- *
1203
- * Returns the ABI Method parameters for the given method name string for the app represented by this application client instance
1204
- * @param method Either the name of the method or the ABI method spec definition string
1205
- * @returns The ABI method params for the given method
1206
- */
1207
- getABIMethodParams(method: string): ABIMethodParams | undefined;
1208
- /**
1209
- * Returns the ABI Method for the given method name string for the app represented by this application client instance
1210
- * @param method Either the name of the method or the ABI method spec definition string
1211
- * @returns The ABI method for the given method
1212
- */
1213
- getABIMethod(method: string): ABIMethod | undefined;
1214
- /**
1215
- * @deprecated Use `appClient.appId` and `appClient.appAddress` from an `AppClient` instance instead.
1216
- *
1217
- * Gets the reference information for the current application instance.
1218
- * `appId` will be 0 if it can't find an app.
1219
- * @returns The app reference, or if deployed using the `deploy` method, the app metadata too
1220
- */
1221
- getAppReference(): Promise<AppMetadata | AppReference>;
1222
- /**
1223
- * Takes an error that may include a logic error from a smart contract call and re-exposes the error to include source code information via the source map.
1224
- * This is automatically used within `ApplicationClient` but if you pass `skipSending: true` e.g. if doing a group transaction
1225
- * then you can use this in a try/catch block to get better debugging information.
1226
- * @param e The error to parse
1227
- * @param isClear Whether or not the code was running the clear state program
1228
- * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
1229
- */
1230
- exposeLogicError(e: Error, isClear?: boolean): Error;
1231
- private getABIMethodSignature;
967
+ export declare class ApplicationClient {
968
+ private algod;
969
+ private indexer?;
970
+ private appSpec;
971
+ private sender;
972
+ private params;
973
+ private existingDeployments;
974
+ private deployTimeParams?;
975
+ private _appId;
976
+ private _appAddress;
977
+ private _creator;
978
+ private _appName;
979
+ private _approvalSourceMap;
980
+ private _clearSourceMap;
981
+ /**
982
+ * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or
983
+ * `algorand.client.getAppClientByCreatorAndName`.
984
+ * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,
985
+ * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.
986
+ *
987
+ * Create a new ApplicationClient instance
988
+ * @param appDetails The details of the app
989
+ * @param algod An algod instance
990
+ */
991
+ constructor(appDetails: AppSpecAppDetails, algod: Algodv2);
992
+ /**
993
+ * @deprecated Use `AppClient.compile()` instead.
994
+ *
995
+ * Compiles the approval and clear state programs and sets up the source map.
996
+ * @param compilation The deploy-time parameters for the compilation
997
+ * @returns The compiled approval and clear state programs
998
+ */
999
+ compile(compilation?: AppClientCompilationParams): Promise<{
1000
+ approvalCompiled: import("./app").CompiledTeal;
1001
+ clearCompiled: import("./app").CompiledTeal;
1002
+ }>;
1003
+ /**
1004
+ * Export the current source maps for the app.
1005
+ * @returns The source maps
1006
+ */
1007
+ exportSourceMaps(): AppSourceMaps;
1008
+ /**
1009
+ * Import source maps for the app.
1010
+ * @param sourceMaps The source maps to import
1011
+ */
1012
+ importSourceMaps(sourceMaps: AppSourceMaps): void;
1013
+ /**
1014
+ * @deprecated Use `deploy` from an `AppFactory` instance instead.
1015
+ *
1016
+ * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
1017
+ *
1018
+ * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/src/content/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
1019
+ *
1020
+ * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.
1021
+ *
1022
+ * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.
1023
+ * @param deploy Deployment details
1024
+ * @returns The metadata and transaction result(s) of the deployment, or just the metadata if it didn't need to issue transactions
1025
+ */
1026
+ deploy(deploy?: AppClientDeployParams): Promise<(Partial<AppCompilationResult> & AppMetadata & {
1027
+ operationPerformed: "nothing";
1028
+ }) | {
1029
+ compiledApproval: import("./app").CompiledTeal;
1030
+ compiledClear: import("./app").CompiledTeal;
1031
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
1032
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1033
+ transaction: algosdk.Transaction;
1034
+ transactions: algosdk.Transaction[];
1035
+ createdRound: number;
1036
+ updatedRound: number;
1037
+ createdMetadata: import("./app").AppDeployMetadata;
1038
+ deleted: boolean;
1039
+ appId: number | bigint;
1040
+ appAddress: string;
1041
+ name: string;
1042
+ version: string;
1043
+ deletable?: boolean;
1044
+ updatable?: boolean;
1045
+ return?: ABIReturn;
1046
+ operationPerformed: "create" | "update";
1047
+ } | {
1048
+ compiledApproval: import("./app").CompiledTeal;
1049
+ compiledClear: import("./app").CompiledTeal;
1050
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
1051
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1052
+ transaction: algosdk.Transaction;
1053
+ transactions: algosdk.Transaction[];
1054
+ createdRound: number;
1055
+ updatedRound: number;
1056
+ createdMetadata: import("./app").AppDeployMetadata;
1057
+ deleted: boolean;
1058
+ appId: number | bigint;
1059
+ appAddress: string;
1060
+ name: string;
1061
+ version: string;
1062
+ deletable?: boolean;
1063
+ updatable?: boolean;
1064
+ return?: ABIReturn;
1065
+ deleteReturn?: ABIReturn;
1066
+ deleteResult: import("./transaction").ConfirmedTransactionResult;
1067
+ operationPerformed: "replace";
1068
+ }>;
1069
+ /**
1070
+ * @deprecated Use `create` from an `AppFactory` instance instead.
1071
+ *
1072
+ * Creates a smart contract app, returns the details of the created app.
1073
+ * @param create The parameters to create the app with
1074
+ * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result
1075
+ */
1076
+ create(create?: AppClientCreateParams): Promise<{
1077
+ compiledApproval: import("./app").CompiledTeal;
1078
+ compiledClear: import("./app").CompiledTeal;
1079
+ return?: ABIReturn | undefined;
1080
+ transactions: algosdk.Transaction[];
1081
+ confirmations?: algosdk.modelsv2.PendingTransactionResponse[];
1082
+ transaction: algosdk.Transaction;
1083
+ confirmation?: algosdk.modelsv2.PendingTransactionResponse;
1084
+ appId: number | bigint;
1085
+ appAddress: string;
1086
+ }>;
1087
+ /**
1088
+ * @deprecated Use `appClient.send.update` or `appClient.createTransaction.update` from an `AppClient` instance instead.
1089
+ *
1090
+ * Updates the smart contract app.
1091
+ * @param update The parameters to update the app with
1092
+ * @returns The transaction send result and the compilation result
1093
+ */
1094
+ update(update?: AppClientUpdateParams): Promise<{
1095
+ compiledApproval: import("./app").CompiledTeal;
1096
+ compiledClear: import("./app").CompiledTeal;
1097
+ return?: ABIReturn | undefined;
1098
+ transactions: algosdk.Transaction[];
1099
+ confirmations?: algosdk.modelsv2.PendingTransactionResponse[];
1100
+ transaction: algosdk.Transaction;
1101
+ confirmation?: algosdk.modelsv2.PendingTransactionResponse;
1102
+ }>;
1103
+ /**
1104
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1105
+ *
1106
+ * Issues a no_op (normal) call to the app.
1107
+ * @param call The call details.
1108
+ * @returns The result of the call
1109
+ */
1110
+ call(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1111
+ /**
1112
+ * @deprecated Use `appClient.send.optIn` or `appClient.createTransaction.optIn` from an `AppClient` instance instead.
1113
+ *
1114
+ * Issues a opt_in call to the app.
1115
+ * @param call The call details.
1116
+ * @returns The result of the call
1117
+ */
1118
+ optIn(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1119
+ /**
1120
+ * @deprecated Use `appClient.send.closeOut` or `appClient.createTransaction.closeOut` from an `AppClient` instance instead.
1121
+ *
1122
+ * Issues a close_out call to the app.
1123
+ * @param call The call details.
1124
+ * @returns The result of the call
1125
+ */
1126
+ closeOut(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1127
+ /**
1128
+ * @deprecated Use `appClient.send.clearState` or `appClient.createTransaction.clearState` from an `AppClient` instance instead.
1129
+ *
1130
+ * Issues a clear_state call to the app.
1131
+ * @param call The call details.
1132
+ * @returns The result of the call
1133
+ */
1134
+ clearState(call?: AppClientClearStateParams): Promise<AppCallTransactionResult>;
1135
+ /**
1136
+ * @deprecated Use `appClient.send.delete` or `appClient.createTransaction.delete` from an `AppClient` instance instead.
1137
+ *
1138
+ * Issues a delete_application call to the app.
1139
+ * @param call The call details.
1140
+ * @returns The result of the call
1141
+ */
1142
+ delete(call?: AppClientCallParams): Promise<AppCallTransactionResult>;
1143
+ /**
1144
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1145
+ *
1146
+ * Issues a call to the app with the given call type.
1147
+ * @param call The call details.
1148
+ * @param callType The call type
1149
+ * @returns The result of the call
1150
+ */
1151
+ callOfType(call: AppClientCallParams | undefined, callType: Exclude<AppCallType, 'update_application'> | Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>): Promise<AppCallTransactionResult>;
1152
+ /**
1153
+ * Funds Algo into the app account for this app.
1154
+ * @param fund The parameters for the funding or the funding amount
1155
+ * @returns The result of the funding
1156
+ */
1157
+ fundAppAccount(fund: FundAppAccountParams | AlgoAmount): Promise<(import("./transaction").SendTransactionResult | {
1158
+ groupId: string;
1159
+ txIds: string[];
1160
+ returns?: ABIReturn[] | undefined;
1161
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
1162
+ transactions: algosdk.Transaction[];
1163
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
1164
+ transaction: algosdk.Transaction;
1165
+ }) & {
1166
+ transactions: algosdk.Transaction[];
1167
+ }>;
1168
+ /**
1169
+ * Returns global state for the current app.
1170
+ * @returns The global state
1171
+ */
1172
+ getGlobalState(): Promise<AppState>;
1173
+ /**
1174
+ * Returns local state for the given account / account address.
1175
+ * @returns The global state
1176
+ */
1177
+ getLocalState(account: string | SendTransactionFrom): Promise<AppState>;
1178
+ /**
1179
+ * Returns the names of all current boxes for the current app.
1180
+ * @returns The names of the boxes
1181
+ */
1182
+ getBoxNames(): Promise<BoxName[]>;
1183
+ /**
1184
+ * Returns the value of the given box for the current app.
1185
+ * @param name The name of the box to return either as a string, binary array or `BoxName`
1186
+ * @returns The current box value as a byte array
1187
+ */
1188
+ getBoxValue(name: BoxName | string | Uint8Array): Promise<Uint8Array>;
1189
+ /**
1190
+ * Returns the value of the given box for the current app.
1191
+ * @param name The name of the box to return either as a string, binary array or `BoxName`
1192
+ * @param type
1193
+ * @returns The current box value as a byte array
1194
+ */
1195
+ getBoxValueFromABIType(name: BoxName | string | Uint8Array, type: ABIType): Promise<ABIValue>;
1196
+ /**
1197
+ * Returns the values of all current boxes for the current app.
1198
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
1199
+ * @param filter Optional filter to filter which boxes' values are returned
1200
+ * @returns The (name, value) pair of the boxes with values as raw byte arrays
1201
+ */
1202
+ getBoxValues(filter?: (name: BoxName) => boolean): Promise<{
1203
+ name: BoxName;
1204
+ value: Uint8Array;
1205
+ }[]>;
1206
+ /**
1207
+ * Returns the values of all current boxes for the current app decoded using an ABI Type.
1208
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
1209
+ * @param type The ABI type to decode the values with
1210
+ * @param filter Optional filter to filter which boxes' values are returned
1211
+ * @returns The (name, value) pair of the boxes with values as the ABI Value
1212
+ */
1213
+ getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
1214
+ name: BoxName;
1215
+ value: ABIValue;
1216
+ }[]>;
1217
+ /**
1218
+ * @deprecated Use `appClient.params.*` from an `AppClient` instance instead.
1219
+ *
1220
+ * Returns the arguments for an app call for the given ABI method or raw method specification.
1221
+ * @param args The call args specific to this application client
1222
+ * @param sender The sender of this call. Will be used to fetch any default argument values if applicable
1223
+ * @returns The call args ready to pass into an app call
1224
+ */
1225
+ getCallArgs(args: AppClientCallArgs | undefined, sender: SendTransactionFrom): Promise<AppCallArgs | undefined>;
1226
+ /**
1227
+ * @deprecated Use `appClient.getABIMethod` instead.
1228
+ *
1229
+ * Returns the ABI Method parameters for the given method name string for the app represented by this application client instance
1230
+ * @param method Either the name of the method or the ABI method spec definition string
1231
+ * @returns The ABI method params for the given method
1232
+ */
1233
+ getABIMethodParams(method: string): ABIMethodParams | undefined;
1234
+ /**
1235
+ * Returns the ABI Method for the given method name string for the app represented by this application client instance
1236
+ * @param method Either the name of the method or the ABI method spec definition string
1237
+ * @returns The ABI method for the given method
1238
+ */
1239
+ getABIMethod(method: string): ABIMethod | undefined;
1240
+ /**
1241
+ * @deprecated Use `appClient.appId` and `appClient.appAddress` from an `AppClient` instance instead.
1242
+ *
1243
+ * Gets the reference information for the current application instance.
1244
+ * `appId` will be 0 if it can't find an app.
1245
+ * @returns The app reference, or if deployed using the `deploy` method, the app metadata too
1246
+ */
1247
+ getAppReference(): Promise<AppMetadata | AppReference>;
1248
+ /**
1249
+ * Takes an error that may include a logic error from a smart contract call and re-exposes the error to include source code information via the source map.
1250
+ * This is automatically used within `ApplicationClient` but if you pass `skipSending: true` e.g. if doing a group transaction
1251
+ * then you can use this in a try/catch block to get better debugging information.
1252
+ * @param e The error to parse
1253
+ * @param isClear Whether or not the code was running the clear state program
1254
+ * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
1255
+ */
1256
+ exposeLogicError(e: Error, isClear?: boolean): Error;
1257
+ private getABIMethodSignature;
1232
1258
  }
1233
- //#endregion
1234
- export { AppClient, AppClientBareCallParams, AppClientCallABIArgs, AppClientCallArgs, AppClientCallCoreParams, AppClientCallParams, AppClientCallRawArgs, AppClientClearStateParams, AppClientCompilationParams, AppClientCompilationResult, AppClientCreateOnComplete, AppClientCreateParams, AppClientDeployCallInterfaceParams, AppClientDeployCoreParams, AppClientDeployParams, AppClientMethodCallParams, AppClientParams, AppClientUpdateParams, AppDetails, AppDetailsBase, AppSourceMaps, AppSpecAppDetails, AppSpecAppDetailsBase, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetailsById, ApplicationClient, CallOnComplete, CloneAppClientParams, FundAppAccountParams, FundAppParams, ResolveAppByCreatorAndName, ResolveAppByCreatorAndNameBase, ResolveAppById, ResolveAppByIdBase, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, SourceMapExport };
1235
- //# sourceMappingURL=app-client.d.ts.map