Skip to content

Add get_version SDK method #410

Description

@Levi-Ojukwu

Description:

The invoice_liquidity contract exposes a get_version() view function (at lib.rs:205-207) that returns the contract version string (currently "1.0.0" from constants.rs). However, the SDK does not expose this method, making it impossible for frontend applications to display or check the deployed contract version.

The contract implementation is straightforward:

pub fn get_version(env: Env) -> soroban_sdk::String {
    soroban_sdk::String::from_str(&env, crate::constants::CONTRACT_VERSION)
}

The SDK method should:

  1. Call the contract's get_version view function
  2. Return the version string
  3. Handle the case where the contract is not deployed (return null or throw)

Why it matters: Version checking is essential for frontend compatibility. When the contract is upgraded, frontends need to verify they're interacting with the expected version.

Acceptance Criteria:

  • Create sdk/src/methods/version.ts with a getVersion(client: ILNClient) function
  • Return type should be Promise<string>
  • Add unit tests in sdk/src/methods/version.test.ts using mock client
  • Export from sdk/src/index.ts
  • Add JSDoc documentation

Relevant Files: contracts/invoice_liquidity/src/lib.rs:205-207, contracts/invoice_liquidity/src/constants.rs:5, sdk/src/index.ts


Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions