Skip to content

Conversation

@ethduke
Copy link

@ethduke ethduke commented May 14, 2025

Summary
This PR contains fixes for several issues that were causing crashes when the API didn't return certain fields, had missing token decimal values, used incorrect URL formats, or hit syntax errors in string formatting - making the SDK much more robust when working with different DLMM pools.

  1. Fixed API URL Format (dlmm.py):
  • Changed API_URL = "localhost:3000" to API_URL = "http://localhost:3000"
  • Added required HTTP protocol prefix for proper URL construction
  1. Fixed Missing Quote in String Literal (types.py):
  • Fixed a syntax error at line 32 where a string literal was missing a closing quote
  • Changed return f"{self.value[1]} to return f"{self.value[1]}"
  1. Made feeOwner Field Optional (types.py):
  • Added Optional import from typing module
  • Modified LBPair class to handle cases where feeOwner is not provided
  • Changed type from fee_owner: Pubkey to fee_owner: Optional[Pubkey]
  • Added conditional check in constructor: self.fee_owner = Pubkey.from_string(data["feeOwner"]) if "feeOwner" in data else None
  1. Made decimal Field Optional (types.py):
  • Modified TokenReserve class to make the decimal field optional
  • Changed type from decimal: int to decimal: Optional[int]
  • Added default value for decimal when not provided: self.decimal = data.get("decimal", 9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant