Skip to content

Commit f99f4d4

Browse files
committed
Add changable value parameter to send_transaction method
1 parent 17eb214 commit f99f4d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sdk/wallet.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def change_account(self, account_address: str):
118118
raise KeyError("There is no account with such an address in wallet")
119119
self.active_account = self.__accounts[account_address]
120120

121-
def construct_transaction(self, contract_method: web3._utils.datatypes, gas: int = None) -> dict:
121+
def construct_transaction(self, contract_method: web3._utils.datatypes, gas: int = None, value: int = 0) -> dict:
122122
"""
123123
Takes contract method call object and builds transaction dict with it
124124
@@ -147,6 +147,10 @@ def construct_transaction(self, contract_method: web3._utils.datatypes, gas: int
147147
base_rows['gatewayFee'] = self._gateway_fee
148148

149149
tx = contract_method.buildTransaction(base_rows)
150+
151+
if value:
152+
tx['value'] = value
153+
150154
return tx
151155
except:
152156
raise Exception(
@@ -187,7 +191,7 @@ def construct_and_sign_transaction(self, contract_method: web3._utils.datatypes)
187191
raise Exception(
188192
f"Error while sign transaction: {sys.exc_info()[1]}")
189193

190-
def send_transaction(self, contract_method: web3._utils.datatypes, gas: int = None) -> str:
194+
def send_transaction(self, contract_method: web3._utils.datatypes, gas: int = None, value: int = 0) -> str:
191195
"""
192196
Takes contract method call object, call method to build transaction and push it to the blockchain
193197

0 commit comments

Comments
 (0)