Skip to content

Instantly share code, notes, and snippets.

#create transaction dictionary using API
#sign transaction using private key and web3.py
tx_json = signed_tx.rawTransaction # extract raw tx from signed tx
tx_json = {"rawTransaction": tx_json.hex()} # convert to hex
payload = requests.post('https://tx-gateway.1inch.io/v1.1/' + self.chain_id + '/broadcast', data=self.w3.toJSON(tx_json), headers={"accept": "application/json, text/plain, */*", "content-type": "application/json"})