We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hi, this is my code:
from uniswap.uniswap import UniswapV2Client import time
my_provider = "https://rinkeby.infura.io/v3/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" client = UniswapV2Client("xxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxx", provider=my_provider)
amount_in = 1 * 10 * * 15 min_amount_out = 1 * 10 * * 13 path = [ "0xc778417E063141139Fce010982780140Aa0cD5Ab", "0xc032f269808abf88cd58b6aca9b4515d80b4170c" ] to_address = "xxxxxxxxxxxxxxxxxxxxxxxxxxx" deadline = deadline = int(time.time()) + 1000
tx = client.swap_exact_tokens_for_tokens(amount_in, min_amount_out, path, to_address, deadline)
and I get this error:
<web3._utils.datatypes.Contract object at 0x0000023E9A2B05E0> 0xc778417E063141139Fce010982780140Aa0cD5Ab Approving 1000000000000000 of 0xc778417E063141139Fce010982780140Aa0cD5Ab Traceback (most recent call last): File ".\web3-test-uniswap-rinkeby.py", line 23, in tx = client.swap_exact_tokens_for_tokens(amount_in, min_amount_out, path, to_address, deadline) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 411, in swap_exact_tokens_for_tokens self.approve(path[0], amount) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 179, in approve tx = self._send_transaction(func, params) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 131, in _send_transaction signed_tx = self.conn.eth.account.sign_transaction(tx, private_key=self.private_key) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_utils\decorators.py", line 18, in _wrapper return self.method(obj, *args, **kwargs) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account\account.py", line 667, in sign_transaction ) = sign_transaction_dict(account._key_obj, sanitized_transaction) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\signing.py", line 28, in sign_transaction_dict unsigned_transaction = serializable_unsigned_transaction_from_dict(transaction_dict) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\transactions.py", line 43, in serializable_unsigned_transaction_from_dict assert_valid_fields(transaction_dict) File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\transactions.py", line 147, in assert_valid_fields raise TypeError("Transaction had invalid fields: %r" % invalid) TypeError: Transaction had invalid fields: {'gasPrice': (15000000000,)}
I have 18 eth on my account and I dont get it why gasprice might be an issue. is it because I use a testnet?
thank you
The text was updated successfully, but these errors were encountered:
I know pretty late reply but you have a comma at the end of "15000000000,".
Sorry, something went wrong.
我知道回复很晚,但是您在“15000000000”的末尾有一个逗号。
Can you post some usage documents, in this case, we can all operate better, and we all think it can be called directly.
No branches or pull requests
hi, this is my code:
from uniswap.uniswap import UniswapV2Client
import time
my_provider = "https://rinkeby.infura.io/v3/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client = UniswapV2Client("xxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxx", provider=my_provider)
amount_in = 1 * 10 * * 15
min_amount_out = 1 * 10 * * 13
path = [
"0xc778417E063141139Fce010982780140Aa0cD5Ab",
"0xc032f269808abf88cd58b6aca9b4515d80b4170c"
]
to_address = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
deadline = deadline = int(time.time()) + 1000
tx = client.swap_exact_tokens_for_tokens(amount_in, min_amount_out, path, to_address, deadline)
and I get this error:
<web3._utils.datatypes.Contract object at 0x0000023E9A2B05E0> 0xc778417E063141139Fce010982780140Aa0cD5Ab
Approving 1000000000000000 of 0xc778417E063141139Fce010982780140Aa0cD5Ab
Traceback (most recent call last):
File ".\web3-test-uniswap-rinkeby.py", line 23, in
tx = client.swap_exact_tokens_for_tokens(amount_in, min_amount_out, path, to_address, deadline)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 411, in swap_exact_tokens_for_tokens
self.approve(path[0], amount)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 179, in approve
tx = self._send_transaction(func, params)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\uniswap\uniswap.py", line 131, in _send_transaction
signed_tx = self.conn.eth.account.sign_transaction(tx, private_key=self.private_key)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_utils\decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account\account.py", line 667, in sign_transaction
) = sign_transaction_dict(account._key_obj, sanitized_transaction)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\signing.py", line 28, in sign_transaction_dict
unsigned_transaction = serializable_unsigned_transaction_from_dict(transaction_dict)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\transactions.py", line 43, in serializable_unsigned_transaction_from_dict
assert_valid_fields(transaction_dict)
File "C:\Users\n\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_account_utils\transactions.py", line 147, in assert_valid_fields
raise TypeError("Transaction had invalid fields: %r" % invalid)
TypeError: Transaction had invalid fields: {'gasPrice': (15000000000,)}
I have 18 eth on my account and I dont get it why gasprice might be an issue.
is it because I use a testnet?
thank you
The text was updated successfully, but these errors were encountered: