Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AttributeError: 'approve' object has no attribute 'build_transaction'#312

Unanswered
eth-orangutan asked this question inQ&A
Discussion options

Hi! Trying to use v3 on Polygon to swap MATIC/USDC. Running into the error in the title (full copy below), Using the latest version of Uniswap Python.

I am able to use get_eth_balance() and get_price_impact just fine, but make_trade runs into the error below.

from uniswap import Uniswapimport configfrom web3 import Web3from web3.middleware import geth_poa_middlewareweb3 = Web3(Web3.HTTPProvider(config.node_address))print("Connected to Polygon Node: ", web3.isConnected())web3.middleware_onion.inject(geth_poa_middleware, layer=0)address = config.my_wallet_addressprivate_key = config.my_private_keyversion = 3provider = config.endpointuniswap = Uniswap(address=address, private_key=private_key,                  version=version, web3=web3)print(uniswap.get_eth_balance())  # works fineprint(uniswap.get_price_input(config.matic_address,      config.usdc_address, 10**18))  # works fineuniswap.make_trade(config.matic_address,                   config.usdc_address, 10**18, fee="500")

Traceback (most recent call last):
File "/home/michael/Documents/2023shit/swap.py", line 27, in
uniswap.make_trade(config.matic_address,
File "/home/michael/.local/lib/python3.8/site-packages/uniswap/decorators.py", line 37, in approved
self.approve(token)
File "/home/michael/.local/lib/python3.8/site-packages/uniswap/uniswap.py", line 1409, in approve
tx = self._build_and_send_tx(function)
File "/home/michael/.local/lib/python3.8/site-packages/uniswap/uniswap.py", line 1443, in _build_and_send_tx
transaction = function.build_transaction(tx_params)
AttributeError: 'approve' object has no attribute 'build_transaction'

You must be logged in to vote

Replies: 2 comments

Comment options

I'm experiencing this as well. Any progress since January ?

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@eth-orangutan@matthieuoliveira

[8]ページ先頭

©2009-2025 Movatter.jp