arc56-generated-krish-e5eda0da 1.2.2026072010__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arc56_generated_krish_e5eda0da/TaskBounty_13b9f12c.py +651 -0
- arc56_generated_krish_e5eda0da/__init__.py +1 -0
- arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/METADATA +73 -0
- arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/RECORD +5 -0
- arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
# fmt: off
|
|
3
|
+
# mypy: ignore-errors
|
|
4
|
+
# This file was automatically generated by algokit-client-generator.
|
|
5
|
+
# DO NOT MODIFY IT BY HAND.
|
|
6
|
+
# requires: algokit-utils@^3.0.0
|
|
7
|
+
|
|
8
|
+
# common
|
|
9
|
+
import dataclasses
|
|
10
|
+
import typing
|
|
11
|
+
# core algosdk
|
|
12
|
+
import algosdk
|
|
13
|
+
from algosdk.transaction import OnComplete
|
|
14
|
+
from algosdk.atomic_transaction_composer import TransactionSigner
|
|
15
|
+
from algosdk.source_map import SourceMap
|
|
16
|
+
from algosdk.transaction import Transaction
|
|
17
|
+
from algosdk.v2client.models import SimulateTraceConfig
|
|
18
|
+
# utils
|
|
19
|
+
import algokit_utils
|
|
20
|
+
from algokit_utils import AlgorandClient as _AlgoKitAlgorandClient
|
|
21
|
+
|
|
22
|
+
_APP_SPEC_JSON = r"""{"arcs": [22, 28], "bareActions": {"call": [], "create": []}, "methods": [{"actions": {"call": [], "create": ["NoOp"]}, "args": [{"type": "asset", "name": "asset_id"}, {"type": "uint64", "name": "unitary_price"}], "name": "create_application", "returns": {"type": "void"}, "events": [], "readonly": false, "recommendations": {}}, {"actions": {"call": ["NoOp"], "create": []}, "args": [{"type": "uint64", "name": "unitary_price"}], "name": "set_price", "returns": {"type": "void"}, "events": [], "readonly": false, "recommendations": {}}, {"actions": {"call": ["NoOp"], "create": []}, "args": [{"type": "pay", "name": "mbr_pay"}], "name": "opt_in_to_asset", "returns": {"type": "void"}, "events": [], "readonly": false, "recommendations": {}}, {"actions": {"call": ["NoOp"], "create": []}, "args": [{"type": "pay", "name": "buyer_txn"}, {"type": "uint64", "name": "quantity"}], "name": "buy", "returns": {"type": "void"}, "events": [], "readonly": false, "recommendations": {}}, {"actions": {"call": ["DeleteApplication"], "create": []}, "args": [], "name": "delete_application", "returns": {"type": "void"}, "events": [], "readonly": false, "recommendations": {}}], "name": "TaskBounty", "state": {"keys": {"box": {}, "global": {"asset_id": {"key": "YXNzZXRfaWQ=", "keyType": "AVMString", "valueType": "AVMUint64"}, "unitary_price": {"key": "dW5pdGFyeV9wcmljZQ==", "keyType": "AVMString", "valueType": "AVMUint64"}}, "local": {}}, "maps": {"box": {}, "global": {}, "local": {}}, "schema": {"global": {"bytes": 0, "ints": 2}, "local": {"bytes": 0, "ints": 0}}}, "structs": {}, "events": [], "networks": {}, "sourceInfo": {"approval": {"pcOffsetMethod": "none", "sourceInfo": [{"pc": [85], "errorMessage": "OnCompletion is not DeleteApplication"}, {"pc": [97, 123, 145, 161], "errorMessage": "OnCompletion is not NoOp"}, {"pc": [165], "errorMessage": "can only call when creating"}, {"pc": [88, 100, 126, 148], "errorMessage": "can only call when not creating"}, {"pc": [215, 245, 299, 328], "errorMessage": "check self.asset_id exists"}, {"pc": [289], "errorMessage": "check self.unitary_price exists"}, {"pc": [110, 136], "errorMessage": "transaction type is pay"}]}, "clear": {"pcOffsetMethod": "none", "sourceInfo": []}}}"""
|
|
23
|
+
APP_SPEC = algokit_utils.Arc56Contract.from_json(_APP_SPEC_JSON)
|
|
24
|
+
|
|
25
|
+
def _parse_abi_args(args: object | None = None) -> list[object] | None:
|
|
26
|
+
"""Helper to parse ABI args into the format expected by underlying client"""
|
|
27
|
+
if args is None:
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
def convert_dataclass(value: object) -> object:
|
|
31
|
+
if dataclasses.is_dataclass(value):
|
|
32
|
+
return tuple(convert_dataclass(getattr(value, field.name)) for field in dataclasses.fields(value))
|
|
33
|
+
elif isinstance(value, (list, tuple)):
|
|
34
|
+
return type(value)(convert_dataclass(item) for item in value)
|
|
35
|
+
return value
|
|
36
|
+
|
|
37
|
+
match args:
|
|
38
|
+
case tuple():
|
|
39
|
+
method_args = list(args)
|
|
40
|
+
case _ if dataclasses.is_dataclass(args):
|
|
41
|
+
method_args = [getattr(args, field.name) for field in dataclasses.fields(args)]
|
|
42
|
+
case _:
|
|
43
|
+
raise ValueError("Invalid 'args' type. Expected 'tuple' or 'TypedDict' for respective typed arguments.")
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
convert_dataclass(arg) if not isinstance(arg, algokit_utils.AppMethodCallTransactionArgument) else arg
|
|
47
|
+
for arg in method_args
|
|
48
|
+
] if method_args else None
|
|
49
|
+
|
|
50
|
+
def _init_dataclass(cls: type, data: dict) -> object:
|
|
51
|
+
"""
|
|
52
|
+
Recursively instantiate a dataclass of type `cls` from `data`.
|
|
53
|
+
|
|
54
|
+
For each field on the dataclass, if the field type is also a dataclass
|
|
55
|
+
and the corresponding data is a dict, instantiate that field recursively.
|
|
56
|
+
"""
|
|
57
|
+
field_values = {}
|
|
58
|
+
for field in dataclasses.fields(cls):
|
|
59
|
+
field_value = data.get(field.name)
|
|
60
|
+
# Check if the field expects another dataclass and the value is a dict.
|
|
61
|
+
if dataclasses.is_dataclass(field.type) and isinstance(field_value, dict):
|
|
62
|
+
field_values[field.name] = _init_dataclass(typing.cast(type, field.type), field_value)
|
|
63
|
+
else:
|
|
64
|
+
field_values[field.name] = field_value
|
|
65
|
+
return cls(**field_values)
|
|
66
|
+
|
|
67
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
68
|
+
class SetPriceArgs:
|
|
69
|
+
"""Dataclass for set_price arguments"""
|
|
70
|
+
unitary_price: int
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def abi_method_signature(self) -> str:
|
|
74
|
+
return "set_price(uint64)void"
|
|
75
|
+
|
|
76
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
77
|
+
class OptInToAssetArgs:
|
|
78
|
+
"""Dataclass for opt_in_to_asset arguments"""
|
|
79
|
+
mbr_pay: algokit_utils.AppMethodCallTransactionArgument
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def abi_method_signature(self) -> str:
|
|
83
|
+
return "opt_in_to_asset(pay)void"
|
|
84
|
+
|
|
85
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
86
|
+
class BuyArgs:
|
|
87
|
+
"""Dataclass for buy arguments"""
|
|
88
|
+
buyer_txn: algokit_utils.AppMethodCallTransactionArgument
|
|
89
|
+
quantity: int
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def abi_method_signature(self) -> str:
|
|
93
|
+
return "buy(pay,uint64)void"
|
|
94
|
+
|
|
95
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
96
|
+
class CreateApplicationArgs:
|
|
97
|
+
"""Dataclass for create_application arguments"""
|
|
98
|
+
asset_id: int
|
|
99
|
+
unitary_price: int
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def abi_method_signature(self) -> str:
|
|
103
|
+
return "create_application(asset,uint64)void"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class TaskBountyParams:
|
|
107
|
+
def __init__(self, app_client: algokit_utils.AppClient):
|
|
108
|
+
self.app_client = app_client
|
|
109
|
+
|
|
110
|
+
def set_price(
|
|
111
|
+
self,
|
|
112
|
+
args: tuple[int] | SetPriceArgs,
|
|
113
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
114
|
+
) -> algokit_utils.AppCallMethodCallParams:
|
|
115
|
+
method_args = _parse_abi_args(args)
|
|
116
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
117
|
+
return self.app_client.params.call(algokit_utils.AppClientMethodCallParams(**{
|
|
118
|
+
**dataclasses.asdict(params),
|
|
119
|
+
"method": "set_price(uint64)void",
|
|
120
|
+
"args": method_args,
|
|
121
|
+
}))
|
|
122
|
+
|
|
123
|
+
def opt_in_to_asset(
|
|
124
|
+
self,
|
|
125
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument] | OptInToAssetArgs,
|
|
126
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
127
|
+
) -> algokit_utils.AppCallMethodCallParams:
|
|
128
|
+
method_args = _parse_abi_args(args)
|
|
129
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
130
|
+
return self.app_client.params.call(algokit_utils.AppClientMethodCallParams(**{
|
|
131
|
+
**dataclasses.asdict(params),
|
|
132
|
+
"method": "opt_in_to_asset(pay)void",
|
|
133
|
+
"args": method_args,
|
|
134
|
+
}))
|
|
135
|
+
|
|
136
|
+
def buy(
|
|
137
|
+
self,
|
|
138
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument, int] | BuyArgs,
|
|
139
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
140
|
+
) -> algokit_utils.AppCallMethodCallParams:
|
|
141
|
+
method_args = _parse_abi_args(args)
|
|
142
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
143
|
+
return self.app_client.params.call(algokit_utils.AppClientMethodCallParams(**{
|
|
144
|
+
**dataclasses.asdict(params),
|
|
145
|
+
"method": "buy(pay,uint64)void",
|
|
146
|
+
"args": method_args,
|
|
147
|
+
}))
|
|
148
|
+
|
|
149
|
+
def clear_state(
|
|
150
|
+
self,
|
|
151
|
+
params: algokit_utils.AppClientBareCallParams | None = None,
|
|
152
|
+
|
|
153
|
+
) -> algokit_utils.AppCallParams:
|
|
154
|
+
return self.app_client.params.bare.clear_state(
|
|
155
|
+
params,
|
|
156
|
+
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class TaskBountyCreateTransactionParams:
|
|
161
|
+
def __init__(self, app_client: algokit_utils.AppClient):
|
|
162
|
+
self.app_client = app_client
|
|
163
|
+
|
|
164
|
+
def set_price(
|
|
165
|
+
self,
|
|
166
|
+
args: tuple[int] | SetPriceArgs,
|
|
167
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
168
|
+
) -> algokit_utils.BuiltTransactions:
|
|
169
|
+
method_args = _parse_abi_args(args)
|
|
170
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
171
|
+
return self.app_client.create_transaction.call(algokit_utils.AppClientMethodCallParams(**{
|
|
172
|
+
**dataclasses.asdict(params),
|
|
173
|
+
"method": "set_price(uint64)void",
|
|
174
|
+
"args": method_args,
|
|
175
|
+
}))
|
|
176
|
+
|
|
177
|
+
def opt_in_to_asset(
|
|
178
|
+
self,
|
|
179
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument] | OptInToAssetArgs,
|
|
180
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
181
|
+
) -> algokit_utils.BuiltTransactions:
|
|
182
|
+
method_args = _parse_abi_args(args)
|
|
183
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
184
|
+
return self.app_client.create_transaction.call(algokit_utils.AppClientMethodCallParams(**{
|
|
185
|
+
**dataclasses.asdict(params),
|
|
186
|
+
"method": "opt_in_to_asset(pay)void",
|
|
187
|
+
"args": method_args,
|
|
188
|
+
}))
|
|
189
|
+
|
|
190
|
+
def buy(
|
|
191
|
+
self,
|
|
192
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument, int] | BuyArgs,
|
|
193
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
194
|
+
) -> algokit_utils.BuiltTransactions:
|
|
195
|
+
method_args = _parse_abi_args(args)
|
|
196
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
197
|
+
return self.app_client.create_transaction.call(algokit_utils.AppClientMethodCallParams(**{
|
|
198
|
+
**dataclasses.asdict(params),
|
|
199
|
+
"method": "buy(pay,uint64)void",
|
|
200
|
+
"args": method_args,
|
|
201
|
+
}))
|
|
202
|
+
|
|
203
|
+
def clear_state(
|
|
204
|
+
self,
|
|
205
|
+
params: algokit_utils.AppClientBareCallParams | None = None,
|
|
206
|
+
|
|
207
|
+
) -> Transaction:
|
|
208
|
+
return self.app_client.create_transaction.bare.clear_state(
|
|
209
|
+
params,
|
|
210
|
+
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class TaskBountySend:
|
|
215
|
+
def __init__(self, app_client: algokit_utils.AppClient):
|
|
216
|
+
self.app_client = app_client
|
|
217
|
+
|
|
218
|
+
def set_price(
|
|
219
|
+
self,
|
|
220
|
+
args: tuple[int] | SetPriceArgs,
|
|
221
|
+
params: algokit_utils.CommonAppCallParams | None = None,
|
|
222
|
+
send_params: algokit_utils.SendParams | None = None
|
|
223
|
+
) -> algokit_utils.SendAppTransactionResult[None]:
|
|
224
|
+
method_args = _parse_abi_args(args)
|
|
225
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
226
|
+
response = self.app_client.send.call(algokit_utils.AppClientMethodCallParams(**{
|
|
227
|
+
**dataclasses.asdict(params),
|
|
228
|
+
"method": "set_price(uint64)void",
|
|
229
|
+
"args": method_args,
|
|
230
|
+
}), send_params=send_params)
|
|
231
|
+
parsed_response = response
|
|
232
|
+
return typing.cast(algokit_utils.SendAppTransactionResult[None], parsed_response)
|
|
233
|
+
|
|
234
|
+
def opt_in_to_asset(
|
|
235
|
+
self,
|
|
236
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument] | OptInToAssetArgs,
|
|
237
|
+
params: algokit_utils.CommonAppCallParams | None = None,
|
|
238
|
+
send_params: algokit_utils.SendParams | None = None
|
|
239
|
+
) -> algokit_utils.SendAppTransactionResult[None]:
|
|
240
|
+
method_args = _parse_abi_args(args)
|
|
241
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
242
|
+
response = self.app_client.send.call(algokit_utils.AppClientMethodCallParams(**{
|
|
243
|
+
**dataclasses.asdict(params),
|
|
244
|
+
"method": "opt_in_to_asset(pay)void",
|
|
245
|
+
"args": method_args,
|
|
246
|
+
}), send_params=send_params)
|
|
247
|
+
parsed_response = response
|
|
248
|
+
return typing.cast(algokit_utils.SendAppTransactionResult[None], parsed_response)
|
|
249
|
+
|
|
250
|
+
def buy(
|
|
251
|
+
self,
|
|
252
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument, int] | BuyArgs,
|
|
253
|
+
params: algokit_utils.CommonAppCallParams | None = None,
|
|
254
|
+
send_params: algokit_utils.SendParams | None = None
|
|
255
|
+
) -> algokit_utils.SendAppTransactionResult[None]:
|
|
256
|
+
method_args = _parse_abi_args(args)
|
|
257
|
+
params = params or algokit_utils.CommonAppCallParams()
|
|
258
|
+
response = self.app_client.send.call(algokit_utils.AppClientMethodCallParams(**{
|
|
259
|
+
**dataclasses.asdict(params),
|
|
260
|
+
"method": "buy(pay,uint64)void",
|
|
261
|
+
"args": method_args,
|
|
262
|
+
}), send_params=send_params)
|
|
263
|
+
parsed_response = response
|
|
264
|
+
return typing.cast(algokit_utils.SendAppTransactionResult[None], parsed_response)
|
|
265
|
+
|
|
266
|
+
def clear_state(
|
|
267
|
+
self,
|
|
268
|
+
params: algokit_utils.AppClientBareCallParams | None = None,
|
|
269
|
+
send_params: algokit_utils.SendParams | None = None
|
|
270
|
+
) -> algokit_utils.SendAppTransactionResult[algokit_utils.ABIReturn]:
|
|
271
|
+
return self.app_client.send.bare.clear_state(
|
|
272
|
+
params,
|
|
273
|
+
send_params=send_params,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class GlobalStateValue(typing.TypedDict):
|
|
278
|
+
"""Shape of global_state state key values"""
|
|
279
|
+
asset_id: int
|
|
280
|
+
unitary_price: int
|
|
281
|
+
|
|
282
|
+
class TaskBountyState:
|
|
283
|
+
"""Methods to access state for the current TaskBounty app"""
|
|
284
|
+
|
|
285
|
+
def __init__(self, app_client: algokit_utils.AppClient):
|
|
286
|
+
self.app_client = app_client
|
|
287
|
+
|
|
288
|
+
@property
|
|
289
|
+
def global_state(
|
|
290
|
+
self
|
|
291
|
+
) -> "_GlobalState":
|
|
292
|
+
"""Methods to access global_state for the current app"""
|
|
293
|
+
return _GlobalState(self.app_client)
|
|
294
|
+
|
|
295
|
+
class _GlobalState:
|
|
296
|
+
def __init__(self, app_client: algokit_utils.AppClient):
|
|
297
|
+
self.app_client = app_client
|
|
298
|
+
|
|
299
|
+
# Pre-generated mapping of value types to their struct classes
|
|
300
|
+
self._struct_classes: dict[str, typing.Type[typing.Any]] = {}
|
|
301
|
+
|
|
302
|
+
def get_all(self) -> GlobalStateValue:
|
|
303
|
+
"""Get all current keyed values from global_state state"""
|
|
304
|
+
result = self.app_client.state.global_state.get_all()
|
|
305
|
+
if not result:
|
|
306
|
+
return typing.cast(GlobalStateValue, {})
|
|
307
|
+
|
|
308
|
+
converted = {}
|
|
309
|
+
for key, value in result.items():
|
|
310
|
+
key_info = self.app_client.app_spec.state.keys.global_state.get(key)
|
|
311
|
+
struct_class = self._struct_classes.get(key_info.value_type) if key_info else None
|
|
312
|
+
converted[key] = (
|
|
313
|
+
_init_dataclass(struct_class, value) if struct_class and isinstance(value, dict)
|
|
314
|
+
else value
|
|
315
|
+
)
|
|
316
|
+
return typing.cast(GlobalStateValue, converted)
|
|
317
|
+
|
|
318
|
+
@property
|
|
319
|
+
def asset_id(self) -> int:
|
|
320
|
+
"""Get the current value of the asset_id key in global_state state"""
|
|
321
|
+
value = self.app_client.state.global_state.get_value("asset_id")
|
|
322
|
+
if isinstance(value, dict) and "AVMUint64" in self._struct_classes:
|
|
323
|
+
return _init_dataclass(self._struct_classes["AVMUint64"], value) # type: ignore
|
|
324
|
+
return typing.cast(int, value)
|
|
325
|
+
|
|
326
|
+
@property
|
|
327
|
+
def unitary_price(self) -> int:
|
|
328
|
+
"""Get the current value of the unitary_price key in global_state state"""
|
|
329
|
+
value = self.app_client.state.global_state.get_value("unitary_price")
|
|
330
|
+
if isinstance(value, dict) and "AVMUint64" in self._struct_classes:
|
|
331
|
+
return _init_dataclass(self._struct_classes["AVMUint64"], value) # type: ignore
|
|
332
|
+
return typing.cast(int, value)
|
|
333
|
+
|
|
334
|
+
class TaskBountyClient:
|
|
335
|
+
"""Client for interacting with TaskBounty smart contract"""
|
|
336
|
+
|
|
337
|
+
@typing.overload
|
|
338
|
+
def __init__(self, app_client: algokit_utils.AppClient) -> None: ...
|
|
339
|
+
|
|
340
|
+
@typing.overload
|
|
341
|
+
def __init__(
|
|
342
|
+
self,
|
|
343
|
+
*,
|
|
344
|
+
algorand: _AlgoKitAlgorandClient,
|
|
345
|
+
app_id: int,
|
|
346
|
+
app_name: str | None = None,
|
|
347
|
+
default_sender: str | None = None,
|
|
348
|
+
default_signer: TransactionSigner | None = None,
|
|
349
|
+
approval_source_map: SourceMap | None = None,
|
|
350
|
+
clear_source_map: SourceMap | None = None,
|
|
351
|
+
) -> None: ...
|
|
352
|
+
|
|
353
|
+
def __init__(
|
|
354
|
+
self,
|
|
355
|
+
app_client: algokit_utils.AppClient | None = None,
|
|
356
|
+
*,
|
|
357
|
+
algorand: _AlgoKitAlgorandClient | None = None,
|
|
358
|
+
app_id: int | None = None,
|
|
359
|
+
app_name: str | None = None,
|
|
360
|
+
default_sender: str | None = None,
|
|
361
|
+
default_signer: TransactionSigner | None = None,
|
|
362
|
+
approval_source_map: SourceMap | None = None,
|
|
363
|
+
clear_source_map: SourceMap | None = None,
|
|
364
|
+
) -> None:
|
|
365
|
+
if app_client:
|
|
366
|
+
self.app_client = app_client
|
|
367
|
+
elif algorand and app_id:
|
|
368
|
+
self.app_client = algokit_utils.AppClient(
|
|
369
|
+
algokit_utils.AppClientParams(
|
|
370
|
+
algorand=algorand,
|
|
371
|
+
app_spec=APP_SPEC,
|
|
372
|
+
app_id=app_id,
|
|
373
|
+
app_name=app_name,
|
|
374
|
+
default_sender=default_sender,
|
|
375
|
+
default_signer=default_signer,
|
|
376
|
+
approval_source_map=approval_source_map,
|
|
377
|
+
clear_source_map=clear_source_map,
|
|
378
|
+
)
|
|
379
|
+
)
|
|
380
|
+
else:
|
|
381
|
+
raise ValueError("Either app_client or algorand and app_id must be provided")
|
|
382
|
+
|
|
383
|
+
self.params = TaskBountyParams(self.app_client)
|
|
384
|
+
self.create_transaction = TaskBountyCreateTransactionParams(self.app_client)
|
|
385
|
+
self.send = TaskBountySend(self.app_client)
|
|
386
|
+
self.state = TaskBountyState(self.app_client)
|
|
387
|
+
|
|
388
|
+
@staticmethod
|
|
389
|
+
def from_creator_and_name(
|
|
390
|
+
creator_address: str,
|
|
391
|
+
app_name: str,
|
|
392
|
+
algorand: _AlgoKitAlgorandClient,
|
|
393
|
+
default_sender: str | None = None,
|
|
394
|
+
default_signer: TransactionSigner | None = None,
|
|
395
|
+
approval_source_map: SourceMap | None = None,
|
|
396
|
+
clear_source_map: SourceMap | None = None,
|
|
397
|
+
ignore_cache: bool | None = None,
|
|
398
|
+
app_lookup_cache: algokit_utils.ApplicationLookup | None = None,
|
|
399
|
+
) -> "TaskBountyClient":
|
|
400
|
+
return TaskBountyClient(
|
|
401
|
+
algokit_utils.AppClient.from_creator_and_name(
|
|
402
|
+
creator_address=creator_address,
|
|
403
|
+
app_name=app_name,
|
|
404
|
+
app_spec=APP_SPEC,
|
|
405
|
+
algorand=algorand,
|
|
406
|
+
default_sender=default_sender,
|
|
407
|
+
default_signer=default_signer,
|
|
408
|
+
approval_source_map=approval_source_map,
|
|
409
|
+
clear_source_map=clear_source_map,
|
|
410
|
+
ignore_cache=ignore_cache,
|
|
411
|
+
app_lookup_cache=app_lookup_cache,
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
@staticmethod
|
|
416
|
+
def from_network(
|
|
417
|
+
algorand: _AlgoKitAlgorandClient,
|
|
418
|
+
app_name: str | None = None,
|
|
419
|
+
default_sender: str | None = None,
|
|
420
|
+
default_signer: TransactionSigner | None = None,
|
|
421
|
+
approval_source_map: SourceMap | None = None,
|
|
422
|
+
clear_source_map: SourceMap | None = None,
|
|
423
|
+
) -> "TaskBountyClient":
|
|
424
|
+
return TaskBountyClient(
|
|
425
|
+
algokit_utils.AppClient.from_network(
|
|
426
|
+
app_spec=APP_SPEC,
|
|
427
|
+
algorand=algorand,
|
|
428
|
+
app_name=app_name,
|
|
429
|
+
default_sender=default_sender,
|
|
430
|
+
default_signer=default_signer,
|
|
431
|
+
approval_source_map=approval_source_map,
|
|
432
|
+
clear_source_map=clear_source_map,
|
|
433
|
+
)
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def app_id(self) -> int:
|
|
438
|
+
return self.app_client.app_id
|
|
439
|
+
|
|
440
|
+
@property
|
|
441
|
+
def app_address(self) -> str:
|
|
442
|
+
return self.app_client.app_address
|
|
443
|
+
|
|
444
|
+
@property
|
|
445
|
+
def app_name(self) -> str:
|
|
446
|
+
return self.app_client.app_name
|
|
447
|
+
|
|
448
|
+
@property
|
|
449
|
+
def app_spec(self) -> algokit_utils.Arc56Contract:
|
|
450
|
+
return self.app_client.app_spec
|
|
451
|
+
|
|
452
|
+
@property
|
|
453
|
+
def algorand(self) -> _AlgoKitAlgorandClient:
|
|
454
|
+
return self.app_client.algorand
|
|
455
|
+
|
|
456
|
+
def clone(
|
|
457
|
+
self,
|
|
458
|
+
app_name: str | None = None,
|
|
459
|
+
default_sender: str | None = None,
|
|
460
|
+
default_signer: TransactionSigner | None = None,
|
|
461
|
+
approval_source_map: SourceMap | None = None,
|
|
462
|
+
clear_source_map: SourceMap | None = None,
|
|
463
|
+
) -> "TaskBountyClient":
|
|
464
|
+
return TaskBountyClient(
|
|
465
|
+
self.app_client.clone(
|
|
466
|
+
app_name=app_name,
|
|
467
|
+
default_sender=default_sender,
|
|
468
|
+
default_signer=default_signer,
|
|
469
|
+
approval_source_map=approval_source_map,
|
|
470
|
+
clear_source_map=clear_source_map,
|
|
471
|
+
)
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
def new_group(self) -> "TaskBountyComposer":
|
|
475
|
+
return TaskBountyComposer(self)
|
|
476
|
+
|
|
477
|
+
@typing.overload
|
|
478
|
+
def decode_return_value(
|
|
479
|
+
self,
|
|
480
|
+
method: typing.Literal["set_price(uint64)void"],
|
|
481
|
+
return_value: algokit_utils.ABIReturn | None
|
|
482
|
+
) -> None: ...
|
|
483
|
+
@typing.overload
|
|
484
|
+
def decode_return_value(
|
|
485
|
+
self,
|
|
486
|
+
method: typing.Literal["opt_in_to_asset(pay)void"],
|
|
487
|
+
return_value: algokit_utils.ABIReturn | None
|
|
488
|
+
) -> None: ...
|
|
489
|
+
@typing.overload
|
|
490
|
+
def decode_return_value(
|
|
491
|
+
self,
|
|
492
|
+
method: typing.Literal["buy(pay,uint64)void"],
|
|
493
|
+
return_value: algokit_utils.ABIReturn | None
|
|
494
|
+
) -> None: ...
|
|
495
|
+
@typing.overload
|
|
496
|
+
def decode_return_value(
|
|
497
|
+
self,
|
|
498
|
+
method: typing.Literal["create_application(asset,uint64)void"],
|
|
499
|
+
return_value: algokit_utils.ABIReturn | None
|
|
500
|
+
) -> None: ...
|
|
501
|
+
@typing.overload
|
|
502
|
+
def decode_return_value(
|
|
503
|
+
self,
|
|
504
|
+
method: typing.Literal["delete_application()void"],
|
|
505
|
+
return_value: algokit_utils.ABIReturn | None
|
|
506
|
+
) -> None: ...
|
|
507
|
+
@typing.overload
|
|
508
|
+
def decode_return_value(
|
|
509
|
+
self,
|
|
510
|
+
method: str,
|
|
511
|
+
return_value: algokit_utils.ABIReturn | None
|
|
512
|
+
) -> algokit_utils.ABIValue | algokit_utils.ABIStruct | None: ...
|
|
513
|
+
|
|
514
|
+
def decode_return_value(
|
|
515
|
+
self,
|
|
516
|
+
method: str,
|
|
517
|
+
return_value: algokit_utils.ABIReturn | None
|
|
518
|
+
) -> algokit_utils.ABIValue | algokit_utils.ABIStruct | None:
|
|
519
|
+
"""Decode ABI return value for the given method."""
|
|
520
|
+
if return_value is None:
|
|
521
|
+
return None
|
|
522
|
+
|
|
523
|
+
arc56_method = self.app_spec.get_arc56_method(method)
|
|
524
|
+
decoded = return_value.get_arc56_value(arc56_method, self.app_spec.structs)
|
|
525
|
+
|
|
526
|
+
# If method returns a struct, convert the dict to appropriate dataclass
|
|
527
|
+
if (arc56_method and
|
|
528
|
+
arc56_method.returns and
|
|
529
|
+
arc56_method.returns.struct and
|
|
530
|
+
isinstance(decoded, dict)):
|
|
531
|
+
struct_class = globals().get(arc56_method.returns.struct)
|
|
532
|
+
if struct_class:
|
|
533
|
+
return struct_class(**typing.cast(dict, decoded))
|
|
534
|
+
return decoded
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class TaskBountyComposer:
|
|
538
|
+
"""Composer for creating transaction groups for TaskBounty contract calls"""
|
|
539
|
+
|
|
540
|
+
def __init__(self, client: "TaskBountyClient"):
|
|
541
|
+
self.client = client
|
|
542
|
+
self._composer = client.algorand.new_group()
|
|
543
|
+
self._result_mappers: list[typing.Callable[[algokit_utils.ABIReturn | None], object] | None] = []
|
|
544
|
+
|
|
545
|
+
def set_price(
|
|
546
|
+
self,
|
|
547
|
+
args: tuple[int] | SetPriceArgs,
|
|
548
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
549
|
+
) -> "TaskBountyComposer":
|
|
550
|
+
self._composer.add_app_call_method_call(
|
|
551
|
+
self.client.params.set_price(
|
|
552
|
+
args=args,
|
|
553
|
+
params=params,
|
|
554
|
+
)
|
|
555
|
+
)
|
|
556
|
+
self._result_mappers.append(
|
|
557
|
+
lambda v: self.client.decode_return_value(
|
|
558
|
+
"set_price(uint64)void", v
|
|
559
|
+
)
|
|
560
|
+
)
|
|
561
|
+
return self
|
|
562
|
+
|
|
563
|
+
def opt_in_to_asset(
|
|
564
|
+
self,
|
|
565
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument] | OptInToAssetArgs,
|
|
566
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
567
|
+
) -> "TaskBountyComposer":
|
|
568
|
+
self._composer.add_app_call_method_call(
|
|
569
|
+
self.client.params.opt_in_to_asset(
|
|
570
|
+
args=args,
|
|
571
|
+
params=params,
|
|
572
|
+
)
|
|
573
|
+
)
|
|
574
|
+
self._result_mappers.append(
|
|
575
|
+
lambda v: self.client.decode_return_value(
|
|
576
|
+
"opt_in_to_asset(pay)void", v
|
|
577
|
+
)
|
|
578
|
+
)
|
|
579
|
+
return self
|
|
580
|
+
|
|
581
|
+
def buy(
|
|
582
|
+
self,
|
|
583
|
+
args: tuple[algokit_utils.AppMethodCallTransactionArgument, int] | BuyArgs,
|
|
584
|
+
params: algokit_utils.CommonAppCallParams | None = None
|
|
585
|
+
) -> "TaskBountyComposer":
|
|
586
|
+
self._composer.add_app_call_method_call(
|
|
587
|
+
self.client.params.buy(
|
|
588
|
+
args=args,
|
|
589
|
+
params=params,
|
|
590
|
+
)
|
|
591
|
+
)
|
|
592
|
+
self._result_mappers.append(
|
|
593
|
+
lambda v: self.client.decode_return_value(
|
|
594
|
+
"buy(pay,uint64)void", v
|
|
595
|
+
)
|
|
596
|
+
)
|
|
597
|
+
return self
|
|
598
|
+
|
|
599
|
+
def clear_state(
|
|
600
|
+
self,
|
|
601
|
+
*,
|
|
602
|
+
args: list[bytes] | None = None,
|
|
603
|
+
params: algokit_utils.CommonAppCallParams | None = None,
|
|
604
|
+
) -> "TaskBountyComposer":
|
|
605
|
+
params=params or algokit_utils.CommonAppCallParams()
|
|
606
|
+
self._composer.add_app_call(
|
|
607
|
+
self.client.params.clear_state(
|
|
608
|
+
algokit_utils.AppClientBareCallParams(
|
|
609
|
+
**{
|
|
610
|
+
**dataclasses.asdict(params),
|
|
611
|
+
"args": args
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
)
|
|
615
|
+
)
|
|
616
|
+
return self
|
|
617
|
+
|
|
618
|
+
def add_transaction(
|
|
619
|
+
self, txn: Transaction, signer: TransactionSigner | None = None
|
|
620
|
+
) -> "TaskBountyComposer":
|
|
621
|
+
self._composer.add_transaction(txn, signer)
|
|
622
|
+
return self
|
|
623
|
+
|
|
624
|
+
def composer(self) -> algokit_utils.TransactionComposer:
|
|
625
|
+
return self._composer
|
|
626
|
+
|
|
627
|
+
def simulate(
|
|
628
|
+
self,
|
|
629
|
+
allow_more_logs: bool | None = None,
|
|
630
|
+
allow_empty_signatures: bool | None = None,
|
|
631
|
+
allow_unnamed_resources: bool | None = None,
|
|
632
|
+
extra_opcode_budget: int | None = None,
|
|
633
|
+
exec_trace_config: SimulateTraceConfig | None = None,
|
|
634
|
+
simulation_round: int | None = None,
|
|
635
|
+
skip_signatures: bool | None = None,
|
|
636
|
+
) -> algokit_utils.SendAtomicTransactionComposerResults:
|
|
637
|
+
return self._composer.simulate(
|
|
638
|
+
allow_more_logs=allow_more_logs,
|
|
639
|
+
allow_empty_signatures=allow_empty_signatures,
|
|
640
|
+
allow_unnamed_resources=allow_unnamed_resources,
|
|
641
|
+
extra_opcode_budget=extra_opcode_budget,
|
|
642
|
+
exec_trace_config=exec_trace_config,
|
|
643
|
+
simulation_round=simulation_round,
|
|
644
|
+
skip_signatures=skip_signatures,
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
def send(
|
|
648
|
+
self,
|
|
649
|
+
send_params: algokit_utils.SendParams | None = None
|
|
650
|
+
) -> algokit_utils.SendAtomicTransactionComposerResults:
|
|
651
|
+
return self._composer.send(send_params)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import TaskBounty_13b9f12c as TaskBounty_13b9f12c
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: arc56-generated-krish_e5eda0da
|
|
3
|
+
Version: 1.2.2026072010
|
|
4
|
+
Summary: Generated ARC-56 Algorand smart-contract clients for krish-9347/ALGO_HACKERS_ALGO---BOUNTY.
|
|
5
|
+
Project-URL: Homepage, https://github.com/scholtz/Arc56Registry
|
|
6
|
+
Project-URL: Repository, https://github.com/scholtz/Arc56Registry
|
|
7
|
+
Author: krish-9347
|
|
8
|
+
Keywords: ALGO_HACKERS_ALGO---BOUNTY,algorand,arc56,avm,generated-client,krish-9347,smart-contract
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: algokit-utils<5.0.0,>=4.2.3
|
|
11
|
+
Requires-Dist: py-algorand-sdk<3.0.0,>=2.11.1
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# arc56-generated-krish_e5eda0da
|
|
15
|
+
|
|
16
|
+
Auto-generated typed Algorand smart-contract clients for **[krish-9347/ALGO_HACKERS_ALGO---BOUNTY](https://github.com/krish-9347/ALGO_HACKERS_ALGO---BOUNTY)**,
|
|
17
|
+
built from the [ARC-56](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0056.md)
|
|
18
|
+
specs listed below.
|
|
19
|
+
|
|
20
|
+
Generated by the [Arc56Registry](https://github.com/scholtz/Arc56Registry) pipeline,
|
|
21
|
+
using the [algorandfoundation/algokit-client-generator-py](https://github.com/algorandfoundation/algokit-client-generator-py)
|
|
22
|
+
ARC-56 client generator. Do not edit these files by hand — they are regenerated
|
|
23
|
+
automatically whenever the source ARC-56 spec changes.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install arc56-generated-krish_e5eda0da
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Basic usage
|
|
32
|
+
|
|
33
|
+
Each contract in this package is a separate module (a hash of its source URL is
|
|
34
|
+
appended to its filename to keep multiple contracts in the same repository from
|
|
35
|
+
colliding), containing a typed `<Name>Client` for interacting with an already-deployed
|
|
36
|
+
instance of that contract, plus a `<Name>Factory` for deploying new instances.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from algokit_utils import AlgorandClient
|
|
40
|
+
from arc56_generated_krish_e5eda0da import TaskBounty_13b9f12c
|
|
41
|
+
|
|
42
|
+
algorand = AlgorandClient.mainnet()
|
|
43
|
+
client = TaskBounty_13b9f12c.TaskBountyClient(
|
|
44
|
+
algorand=algorand,
|
|
45
|
+
app_id=123456789,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# call a contract method, e.g.:
|
|
49
|
+
# result = client.send.some_method(args=(...))
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `full` vs `minimal` generator mode
|
|
53
|
+
|
|
54
|
+
Contracts in this package are generated with the client generator's `full` mode by
|
|
55
|
+
default, which emits both the typed `Client` and a deploy/create `Factory` class plus
|
|
56
|
+
deployment metadata (source code, bytecode, template variables). For the rare contract
|
|
57
|
+
whose `full`-mode output fails to generate or fails to byte-compile, this package falls
|
|
58
|
+
back to `minimal` mode (`Client` only, no `Factory`) for that contract instead of
|
|
59
|
+
failing outright. The contracts table below flags any contract generated this way;
|
|
60
|
+
every other contract includes a working `Factory`.
|
|
61
|
+
|
|
62
|
+
## Contracts included in this package
|
|
63
|
+
|
|
64
|
+
| Module | Client class | Source ARC-56 spec |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `TaskBounty_13b9f12c` | `TaskBountyClient` | [https://raw.githubusercontent.com/krish-9347/ALGO_HACKERS_ALGO---BOUNTY/HEAD/projects/task_bountys-contracts/smart_contracts/artifacts/task_bountys/TaskBounty.arc56.json](https://raw.githubusercontent.com/krish-9347/ALGO_HACKERS_ALGO---BOUNTY/HEAD/projects/task_bountys-contracts/smart_contracts/artifacts/task_bountys/TaskBounty.arc56.json) |
|
|
67
|
+
|
|
68
|
+
## Versioning
|
|
69
|
+
|
|
70
|
+
This package uses `1.<increment>.<yyyyMMddHH>`-style versioning: a new version is
|
|
71
|
+
published whenever any of the contracts above change, or whenever the client generator
|
|
72
|
+
itself is updated. See [Arc56Registry](https://github.com/scholtz/Arc56Registry) for
|
|
73
|
+
the full generation pipeline and source ARC-56 registry.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
arc56_generated_krish_e5eda0da/TaskBounty_13b9f12c.py,sha256=x5bBbzXqEFF2W_-cSKEjO4_lEYDxIB8gJKlQVab1vWI,26036
|
|
2
|
+
arc56_generated_krish_e5eda0da/__init__.py,sha256=kyt6B0okY0VmodGSUl34f1JBEzuGj9zdzmW8n7rTq-A,57
|
|
3
|
+
arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/METADATA,sha256=l-aUDmqxdUr7jbMOW6q5GhGyYI_5i-6yc_LVVz-6QBg,3412
|
|
4
|
+
arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
5
|
+
arc56_generated_krish_e5eda0da-1.2.2026072010.dist-info/RECORD,,
|