michaelhly / solana-py

Solana Python SDK
https://michaelhly.github.io/solana-py
MIT License
1.04k stars 273 forks source link

get_signatures_for_address is missing min_context_slot param #425

Open don1989 opened 6 months ago

don1989 commented 6 months ago

Hello

The min_context_slot param is missing in the get_signatures_for_address method. I noticed that it is present in the config object that we send in the request:

class RpcSignaturesForAddressConfig:
    def __init__(
        self,
        before: Optional[Signature] = None,
        until: Optional[Signature] = None,
        limit: Optional[int] = None,
        commitment: Optional[CommitmentLevel] = None,
        min_context_slot: Optional[int] = None,
    ): ...

However, I don't understand why min_context_slot is missing in get_signatures_for_address and why we're not passing it to the config:

  def _get_signatures_for_address_body(
      self,
      address: Pubkey,
      before: Optional[Signature],
      until: Optional[Signature],
      limit: Optional[int],
      commitment: Optional[Commitment],
  ) -> GetSignaturesForAddress:
      commitment_to_use = _COMMITMENT_TO_SOLDERS[commitment or self._commitment]
      config = RpcSignaturesForAddressConfig(before=before, until=until, limit=limit, commitment=commitment_to_use)
      return GetSignaturesForAddress(address, config)

Is it possible to add it in the next release?

For reference: https://solana.com/docs/rpc/http/getsignaturesforaddress

Thanks

don1989 commented 6 months ago

Its simple enough that I can do a PR. Can I be granted the relevant permissions @michaelhly please?

michaelhly commented 6 months ago

@don1989 Yes. Just add the min_context_slot as an optional argument to the function signature in the following places: https://github.com/michaelhly/solana-py/blob/ff9af6800293b7fda8f542c7da8e5b329e7ec342/src/solana/rpc/api.py#L312 https://github.com/michaelhly/solana-py/blob/ff9af6800293b7fda8f542c7da8e5b329e7ec342/src/solana/rpc/async_api.py#L324 https://github.com/michaelhly/solana-py/blob/ff9af6800293b7fda8f542c7da8e5b329e7ec342/src/solana/rpc/core.py#L214

and then fix any relevant tests, lint and formatting issues.

Please fork this repo and contribute a pull request pointing to michaelhly/solana-py.