def execute(self, data, _sender=None, value="0", receiver=NFT_CONTRACT, gasLimit=60000000): if _sender is None: _sender = self._sender _sender.sync_nonce(self._proxy) t = Transaction() t.nonce = _sender.nonce t.version = get_tx_version() t.data = data t.receiver = receiver t.chainID = self._proxy.get_chain_id() t.gasLimit = gasLimit t.value = value t.sender = self._sender.address.bech32() t.gasPrice = DEFAULT_GAS_PRICE t.sign(self._sender) log("Execution d'une transaction sur " + BC_EXPLORER + "/address/" + t.sender) rc = t.send_wait_result(self._proxy, 60000) for r in rc["smartContractResults"]: if "data" in r: r["result"] = list() for p in r["data"].split("@"): if len(p) > 0: r["result"].append(hex_to_str(int(p, 16))) return rc["smartContractResults"]
def _send_or_simulate(tx: Transaction, args: Any): send_wait_result = args.wait_result and args.send and not args.simulate send_only = args.send and not (args.wait_result or args.simulate) simulate = args.simulate and not (send_only or send_wait_result) if send_wait_result: proxy = ElrondProxy(args.proxy) response = tx.send_wait_result(proxy, args.timeout) return None elif send_only: tx.send(ElrondProxy(args.proxy)) return None elif simulate: response = tx.simulate(ElrondProxy(args.proxy)) return response