Skip to content

Commit 4c15080

Browse files
authored
Drop 'transaction' word from sign methods in Account class (#1278)
1 parent 336e0f2 commit 4c15080

28 files changed

+121
-155
lines changed

docs/migration_guide.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Changes in the :class:`~starknet_py.net.account.account.Account`:
1717
.. currentmodule:: starknet_py.net.account.account
1818

1919
- :meth:`~Account.execute_v3` has been added.
20-
- :meth:`~Account.sign_declare_v3_transaction`, :meth:`~Account.sign_deploy_account_v3_transaction` and :meth:`~Account.sign_invoke_v3_transaction` have been added.
21-
- :meth:`~Account.sign_declare_transaction`, :meth:`~Account.sign_deploy_account_transaction` and :meth:`~Account.sign_invoke_transaction` have been renamed to :meth:`~Account.sign_declare_v1_transaction`, :meth:`~Account.sign_deploy_account_v1_transaction` and :meth:`~Account.sign_invoke_v1_transaction` respectively.
20+
- :meth:`~Account.sign_declare_v3`, :meth:`~Account.sign_deploy_account_v3` and :meth:`~Account.sign_invoke_v3` have been added.
21+
- :meth:`sign_declare_transaction`, :meth:`sign_declare_v2_transaction`, :meth:`sign_deploy_account_transaction` and :meth:`sign_invoke_transaction` have been renamed to :meth:`~Account.sign_declare_v1`, :meth:`~Account.sign_declare_v2`, :meth:`~Account.sign_deploy_account_v1` and :meth:`~Account.sign_invoke_v1` respectively.
2222

2323
All new functions with ``v3`` in their name operate similarly to their ``v1`` and ``v2`` counterparts.
2424
Unlike their ``v1`` counterparts, ``v3`` transaction fees are paid in Fri (10^-18 STRK). Therefore, ``max_fee`` parameter, which is typically set in Wei, is not applicable for ``v3`` functions. Instead, ``l1_resource_bounds`` parameter is utilized to limit the Fri amount used.
@@ -351,7 +351,7 @@ Also, four methods were added to its interface:
351351

352352
.. currentmodule:: starknet_py.net.account.account
353353

354-
2. :meth:`Account.sign_invoke_transaction`, :meth:`Account.sign_declare_transaction`, :meth:`Account.sign_declare_v2_transaction`, :meth:`Account.sign_deploy_account_transaction` and :meth:`Account.execute` can now accept custom ``nonce`` parameter.
354+
2. :meth:`Account.sign_invoke_transaction`, :meth:`Account.sign_declare_transaction`, :meth:`Account.sign_declare_v2`, :meth:`Account.sign_deploy_account_transaction` and :meth:`Account.execute` can now accept custom ``nonce`` parameter.
355355
3. :meth:`Account.get_nonce` can now be parametrized with ``block_number`` or ``block_hash``.
356356
4. :meth:`Account.get_balance` can now be parametrized with ``block_number`` or ``block_hash``.
357357

starknet_py/contract.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ async def invoke(
429429
:return: InvokeResult.
430430
"""
431431

432-
transaction = await self.get_account.sign_invoke_v1_transaction(
432+
transaction = await self.get_account.sign_invoke_v1(
433433
calls=self,
434434
nonce=nonce,
435435
max_fee=max_fee or self.max_fee,
@@ -445,9 +445,7 @@ async def estimate_fee(
445445
*,
446446
nonce: Optional[int] = None,
447447
) -> EstimatedFee:
448-
tx = await self.get_account.sign_invoke_v1_transaction(
449-
calls=self, nonce=nonce, max_fee=0
450-
)
448+
tx = await self.get_account.sign_invoke_v1(calls=self, nonce=nonce, max_fee=0)
451449
estimate_tx = await self.get_account.sign_for_fee_estimate(transaction=tx)
452450

453451
estimated_fee = await self._client.estimate_fee(
@@ -486,7 +484,7 @@ async def invoke(
486484
:return: InvokeResult.
487485
"""
488486

489-
transaction = await self.get_account.sign_invoke_v3_transaction(
487+
transaction = await self.get_account.sign_invoke_v3(
490488
calls=self,
491489
nonce=nonce,
492490
l1_resource_bounds=l1_resource_bounds or self.l1_resource_bounds,
@@ -502,7 +500,7 @@ async def estimate_fee(
502500
*,
503501
nonce: Optional[int] = None,
504502
) -> EstimatedFee:
505-
tx = await self.get_account.sign_invoke_v3_transaction(
503+
tx = await self.get_account.sign_invoke_v3(
506504
calls=self, nonce=nonce, l1_resource_bounds=ResourceBounds.init_with_zeros()
507505
)
508506
estimate_tx = await self.get_account.sign_for_fee_estimate(transaction=tx)
@@ -831,7 +829,7 @@ async def declare_v1(
831829
:return: DeclareResult instance.
832830
"""
833831

834-
declare_tx = await account.sign_declare_v1_transaction(
832+
declare_tx = await account.sign_declare_v1(
835833
compiled_contract=compiled_contract,
836834
nonce=nonce,
837835
max_fee=max_fee,
@@ -871,7 +869,7 @@ async def declare_v2(
871869
compiled_contract_casm, compiled_class_hash
872870
)
873871

874-
declare_tx = await account.sign_declare_v2_transaction(
872+
declare_tx = await account.sign_declare_v2(
875873
compiled_contract=compiled_contract,
876874
compiled_class_hash=compiled_class_hash,
877875
nonce=nonce,
@@ -913,7 +911,7 @@ async def declare_v3(
913911
compiled_contract_casm, compiled_class_hash
914912
)
915913

916-
declare_tx = await account.sign_declare_v3_transaction(
914+
declare_tx = await account.sign_declare_v3(
917915
compiled_contract=compiled_contract,
918916
compiled_class_hash=compiled_class_hash,
919917
nonce=nonce,

starknet_py/net/account/account.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async def sign_for_fee_estimate(
318318
signature = self.signer.sign_transaction(transaction)
319319
return _add_signature_to_transaction(tx=transaction, signature=signature)
320320

321-
async def sign_invoke_v1_transaction(
321+
async def sign_invoke_v1(
322322
self,
323323
calls: Calls,
324324
*,
@@ -335,7 +335,7 @@ async def sign_invoke_v1_transaction(
335335
signature = self.signer.sign_transaction(execute_tx)
336336
return _add_signature_to_transaction(execute_tx, signature)
337337

338-
async def sign_invoke_v3_transaction(
338+
async def sign_invoke_v3(
339339
self,
340340
calls: Calls,
341341
*,
@@ -352,7 +352,7 @@ async def sign_invoke_v3_transaction(
352352
signature = self.signer.sign_transaction(invoke_tx)
353353
return _add_signature_to_transaction(invoke_tx, signature)
354354

355-
async def sign_declare_v1_transaction(
355+
async def sign_declare_v1(
356356
self,
357357
compiled_contract: str,
358358
*,
@@ -362,7 +362,7 @@ async def sign_declare_v1_transaction(
362362
) -> DeclareV1:
363363
if _is_sierra_contract(json.loads(compiled_contract)):
364364
raise ValueError(
365-
"Signing sierra contracts requires using `sign_declare_v2_transaction` method."
365+
"Signing sierra contracts requires using `sign_declare_v2` method."
366366
)
367367

368368
declare_tx = await self._make_declare_v1_transaction(
@@ -376,7 +376,7 @@ async def sign_declare_v1_transaction(
376376
signature = self.signer.sign_transaction(declare_tx)
377377
return _add_signature_to_transaction(declare_tx, signature)
378378

379-
async def sign_declare_v2_transaction(
379+
async def sign_declare_v2(
380380
self,
381381
compiled_contract: str,
382382
compiled_class_hash: int,
@@ -395,7 +395,7 @@ async def sign_declare_v2_transaction(
395395
signature = self.signer.sign_transaction(declare_tx)
396396
return _add_signature_to_transaction(declare_tx, signature)
397397

398-
async def sign_declare_v3_transaction(
398+
async def sign_declare_v3(
399399
self,
400400
compiled_contract: str,
401401
compiled_class_hash: int,
@@ -485,7 +485,7 @@ async def _make_declare_v3_transaction(
485485
)
486486
return declare_tx
487487

488-
async def sign_deploy_account_v1_transaction(
488+
async def sign_deploy_account_v1(
489489
self,
490490
class_hash: int,
491491
contract_address_salt: int,
@@ -513,7 +513,7 @@ async def sign_deploy_account_v1_transaction(
513513
signature = self.signer.sign_transaction(deploy_account_tx)
514514
return _add_signature_to_transaction(deploy_account_tx, signature)
515515

516-
async def sign_deploy_account_v3_transaction(
516+
async def sign_deploy_account_v3(
517517
self,
518518
class_hash: int,
519519
contract_address_salt: int,
@@ -551,7 +551,7 @@ async def execute_v1(
551551
max_fee: Optional[int] = None,
552552
auto_estimate: bool = False,
553553
) -> SentTransactionResponse:
554-
execute_transaction = await self.sign_invoke_v1_transaction(
554+
execute_transaction = await self.sign_invoke_v1(
555555
calls,
556556
nonce=nonce,
557557
max_fee=max_fee,
@@ -567,7 +567,7 @@ async def execute_v3(
567567
nonce: Optional[int] = None,
568568
auto_estimate: bool = False,
569569
) -> SentTransactionResponse:
570-
execute_transaction = await self.sign_invoke_v3_transaction(
570+
execute_transaction = await self.sign_invoke_v3(
571571
calls,
572572
l1_resource_bounds=l1_resource_bounds,
573573
nonce=nonce,
@@ -637,7 +637,7 @@ async def deploy_account_v1(
637637
calldata=calldata,
638638
)
639639

640-
deploy_account_tx = await account.sign_deploy_account_v1_transaction(
640+
deploy_account_tx = await account.sign_deploy_account_v1(
641641
class_hash=class_hash,
642642
contract_address_salt=salt,
643643
constructor_calldata=calldata,
@@ -710,7 +710,7 @@ async def deploy_account_v3(
710710
calldata=calldata,
711711
)
712712

713-
deploy_account_tx = await account.sign_deploy_account_v3_transaction(
713+
deploy_account_tx = await account.sign_deploy_account_v3(
714714
class_hash=class_hash,
715715
contract_address_salt=salt,
716716
constructor_calldata=calldata,

starknet_py/net/account/base_account.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async def sign_for_fee_estimate(
101101
"""
102102

103103
@abstractmethod
104-
async def sign_invoke_v1_transaction(
104+
async def sign_invoke_v1(
105105
self,
106106
calls: Calls,
107107
*,
@@ -120,7 +120,7 @@ async def sign_invoke_v1_transaction(
120120
"""
121121

122122
@abstractmethod
123-
async def sign_invoke_v3_transaction(
123+
async def sign_invoke_v3(
124124
self,
125125
calls: Calls,
126126
*,
@@ -139,7 +139,7 @@ async def sign_invoke_v3_transaction(
139139
"""
140140

141141
@abstractmethod
142-
async def sign_declare_v1_transaction(
142+
async def sign_declare_v1(
143143
self,
144144
compiled_contract: str,
145145
*,
@@ -158,7 +158,7 @@ async def sign_declare_v1_transaction(
158158
"""
159159

160160
@abstractmethod
161-
async def sign_declare_v2_transaction(
161+
async def sign_declare_v2(
162162
self,
163163
compiled_contract: str,
164164
compiled_class_hash: int,
@@ -181,7 +181,7 @@ async def sign_declare_v2_transaction(
181181
"""
182182

183183
@abstractmethod
184-
async def sign_declare_v3_transaction(
184+
async def sign_declare_v3(
185185
self,
186186
compiled_contract: str,
187187
compiled_class_hash: int,
@@ -204,7 +204,7 @@ async def sign_declare_v3_transaction(
204204
"""
205205

206206
@abstractmethod
207-
async def sign_deploy_account_v1_transaction(
207+
async def sign_deploy_account_v1(
208208
self,
209209
class_hash: int,
210210
contract_address_salt: int,
@@ -230,7 +230,7 @@ async def sign_deploy_account_v1_transaction(
230230
"""
231231

232232
@abstractmethod
233-
async def sign_deploy_account_v3_transaction(
233+
async def sign_deploy_account_v3(
234234
self,
235235
class_hash: int,
236236
contract_address_salt: int,

0 commit comments

Comments
 (0)