Skip to content

Commit

Permalink
Merge MiRei, and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinto1024 committed Feb 10, 2022
2 parents 227a9f6 + 67d5efb commit 61c3daf
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions thor_requests/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,10 @@ def transact(
func_params: List,
to: str,
value: int = 0, # Note: value is in Wei
expiration: int = 32,
gasPriceCoef: int = 0,
gas: int = 0,
dependsOn=None, # ID of old Tx that this tx depends on, None or string
force: bool = False, # Force execute even if emulation failed
gas_payer: Wallet = None # fee delegation feature
) -> dict:
Expand All @@ -480,10 +482,14 @@ def transact(
Function params. eg. ['0x123..efg', '100']
value:
VET in Wei to send with this call
expiration:
Expire this tx after how many blocks, relative to blockRef
gasPriceCoef:
Coefficient used to calculate the gas price for the transaction. eg. [0~255]
gas:
Gas you willing to pay to power this contract call.
dependsOn:
ID of the transaction which the current transaction depends on. [32 bytes]
force:
Force execution even if emulation failed.
gas_payer:
Expand All @@ -501,6 +507,8 @@ def transact(
calc_blockRef(self.get_block("best")["id"]),
calc_nonce(),
gasPriceCoef=gasPriceCoef,
dependsOn=dependsOn,
expiration=expiration,
gas=gas,
feeDelegation=need_fee_delegation
)
Expand Down Expand Up @@ -536,7 +544,15 @@ def transact(
return self.post_tx(encoded_raw)

def transact_multi(
self, wallet: Wallet, clauses: List[Clause], gasPriceCoef: int = 0, gas: int = 0, force: bool = False, gas_payer: Wallet = None
self,
wallet: Wallet,
clauses: List[Clause],
gasPriceCoef: int = 0,
gas: int = 0,
dependsOn=None, # ID of old Tx that this tx depends on, None or string
expiration: int = 32,
force: bool = False,
gas_payer: Wallet = None
):
# Emulate the whole tx first.
if gas_payer:
Expand All @@ -554,7 +570,9 @@ def transact_multi(
self.get_chainTag(),
calc_blockRef(self.get_block("best")["id"]),
calc_nonce(),
expiration=expiration,
gasPriceCoef=gasPriceCoef,
dependsOn=dependsOn,
gas=gas,
feeDelegation=need_fee_delegation
)
Expand Down Expand Up @@ -700,4 +718,4 @@ def transfer_token(self, wallet: Wallet, to: str, token_contract_addr: str, amou
See post_tx()
'''
_contract = Contract({"abi": json.loads(VTHO_ABI)})
return self.transact(wallet, _contract, 'transfer', [to, amount_in_wei], token_contract_addr, gas_payer=gas_payer)
return self.transact(wallet, _contract, 'transfer', [to, amount_in_wei], token_contract_addr, gas_payer=gas_payer)

0 comments on commit 61c3daf

Please sign in to comment.