Skip to content

Commit

Permalink
assign fields directly
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Dec 4, 2024
1 parent d9cddea commit 1a3f304
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 348 deletions.
24 changes: 6 additions & 18 deletions multiversx_sdk/account_management/account_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ def create_transaction_for_saving_key_value(self,
key_value_pairs=key_value_pairs
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -47,9 +43,7 @@ def create_transaction_for_setting_guardian(self,
service_id=service_id
)

if relayer:
transaction.relayer = relayer

transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -63,9 +57,7 @@ def create_transaction_for_guarding_account(self,
sender=sender.address
)

if relayer:
transaction.relayer = relayer

transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -80,12 +72,8 @@ def create_transaction_for_unguarding_account(self,
sender=sender.address
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand Down
158 changes: 40 additions & 118 deletions multiversx_sdk/delegation/delegation_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ def create_transaction_for_new_delegation_contract(self,
amount=amount
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand Down Expand Up @@ -75,12 +71,8 @@ def create_transaction_for_adding_nodes(self,
signed_messages=signed_messages
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -99,12 +91,8 @@ def create_transaction_for_removing_nodes(self,
public_keys=public_keys
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -123,12 +111,8 @@ def create_transaction_for_staking_nodes(self,
public_keys=public_keys
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -147,12 +131,8 @@ def create_transaction_for_unbonding_nodes(self,
public_keys=public_keys
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -171,12 +151,8 @@ def create_transaction_for_unstaking_nodes(self,
public_keys=public_keys
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -197,12 +173,8 @@ def create_transaction_for_unjailing_nodes(self,
amount=amount
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -221,12 +193,8 @@ def create_transaction_for_changing_service_fee(self,
service_fee=service_fee
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -245,12 +213,8 @@ def create_transaction_for_modifying_delegation_cap(self,
delegation_cap=delegation_cap
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -267,15 +231,10 @@ def create_transaction_for_setting_automatic_activation(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(
self.tx_computer.compute_bytes_for_signing(transaction))
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

return transaction

Expand All @@ -290,12 +249,8 @@ def create_transaction_for_unsetting_automatic_activation(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -312,12 +267,8 @@ def create_transaction_for_setting_cap_check_on_redelegate_rewards(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -334,12 +285,8 @@ def create_transaction_for_unsetting_cap_check_on_redelegate_rewards(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -362,12 +309,8 @@ def create_transaction_for_setting_metadata(self,
identifier=identifier
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -386,15 +329,10 @@ def create_transaction_for_delegating(self,
amount=amount
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(
self.tx_computer.compute_bytes_for_signing(transaction))
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

return transaction

Expand All @@ -409,12 +347,8 @@ def create_transaction_for_claiming_rewards(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -431,12 +365,8 @@ def create_transaction_for_redelegating_rewards(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -455,12 +385,8 @@ def create_transaction_for_undelegating(self,
amount=amount
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -477,12 +403,8 @@ def create_transaction_for_withdrawing(self,
delegation_contract=delegation_contract
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand Down
24 changes: 6 additions & 18 deletions multiversx_sdk/smart_contracts/smart_contract_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ def create_transaction_for_deploy(self,
is_payable_by_sc=is_payable_by_sc
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand Down Expand Up @@ -111,12 +107,8 @@ def create_transaction_for_upgrade(self,
is_payable_by_sc=is_payable_by_sc
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand All @@ -143,12 +135,8 @@ def create_transaction_for_execute(self,
token_transfers=token_transfers
)

if guardian:
transaction.guardian = guardian

if relayer:
transaction.relayer = relayer

transaction.guardian = guardian
transaction.relayer = relayer
transaction.nonce = nonce
transaction.signature = sender.sign(self.tx_computer.compute_bytes_for_signing(transaction))

Expand Down
Loading

0 comments on commit 1a3f304

Please sign in to comment.