kevinheavey / solders

A high-performance Python toolkit for Solana, written in Rust
https://kevinheavey.github.io/solders/
Apache License 2.0
205 stars 23 forks source link

solders.pubkey import Pubkey not working with verify function. #77

Closed aaroncatalano closed 8 months ago

aaroncatalano commented 8 months ago

What versions does your solders library support?

Environment:
Python 3.10 solana-cli 1.17 solana==0.30.2 httpx==0.23.0
solders .19 python-telegram-bot==13

Telegram python bot script does not recognize from solders.pubkey import Pubkey. Import "solders.pubkey" could not be resolved from source

I have dependencies on :

# Verify the signed message
try:
    username, phantom_wallet_address = signed_message.strip().split(' ', 1)  # Limit the split to 1 occurrence
    if Pubkey.verify(username.encode("utf-8"), signed_message, Pubkey(phantom_wallet_address)):
kevinheavey commented 8 months ago

Does import solders give an error?

aaroncatalano commented 8 months ago

Import "solders.pubkey" could not be resolved from source. AttributeError: type object 'solders.pubkey.Pubkey' has no attribute 'verify'

kevinheavey commented 8 months ago

Oh there's no Pubkey.verify method. There's a Signature.verify which is probably what you're looking for https://kevinheavey.github.io/solders/api_reference/signature.html#solders.signature.Signature.verify

Does something somewhere say there is a Pubkey.verify?

aaroncatalano commented 8 months ago

from solders.pubkey import Pubkey. Error: Import "solders.pubkey" could not be resolved from source. The Pubkey is not being imported from solders.pubkey.

kevinheavey commented 8 months ago

Does import solders give an error?

aaroncatalano commented 8 months ago

Import "solders.keypair" could not be resolved from sourcePylancereportMissingModuleSource (module) solders

kevinheavey commented 8 months ago

Ok but that's just a Pylance error. What happens when you actually run the code?

aaroncatalano commented 8 months ago

code: def verify_wallet(update, context): try: username, phantom_wallet_address = signed_message.strip().split(' ', 1) # Limit the split to 1 occurrence if Pubkey.verify(username.encode("utf-8"), signed_message, Pubkey(phantom_wallet_address)):

Error Message: AttributeError: type object 'solders.pubkey.Pubkey' has no attribute 'verify' 2024-01-21 17:25:27,771 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last):

if Pubkey.verify(username.encode("utf-8"), signed_message, Pubkey(phantom_wallet_address)):
kevinheavey commented 8 months ago

Can you please communicate better

aaroncatalano commented 8 months ago

Is solders compatible with: Python 3.10 solana-cli 1.17 solana==0.30.2? //

kevinheavey commented 8 months ago

This is not what a good GitHub issue looks like

aaroncatalano commented 7 months ago

Your solders library. From solders.pubkey import Pubkey., does not support Verify function?
from solders.pubkey import Pubkey def verify_wallet(update, context): try: username, phantom_wallet_address = signed_message.strip().split(' ', 1) # Limit the split to 1 occurrence if Pubkey.verify(username.encode("utf-8"), signed_message, Pubkey(phantom_wallet_address)):

kevinheavey commented 7 months ago

Please read https://github.com/kevinheavey/solders/issues/77#issuecomment-1902785061