Skip to content

feat(contracts): implement token balance checks#66

Open
h1065153539-create wants to merge 1 commit into
Adamantine-guild:mainfrom
h1065153539-create:feat/token-balance-checks
Open

feat(contracts): implement token balance checks#66
h1065153539-create wants to merge 1 commit into
Adamantine-guild:mainfrom
h1065153539-create:feat/token-balance-checks

Conversation

@h1065153539-create

Copy link
Copy Markdown
Contributor

Summary

/claim #11

Implements ContractClient.getMembershipTokenBalance so SDK users can query membership token balances through the configured JSON-RPC provider instead of receiving NOT_IMPLEMENTED.

Changes

  • Validates wallet and contract addresses before making RPC calls.
  • Requires rpcUrl and either a configured or per-call contractAddress with clear INVALID_CONFIG errors.
  • Encodes balanceOf(address) calldata and sends a read-only eth_call.
  • Decodes the returned uint256 balance and returns it as a decimal string.
  • Surfaces RPC errors and malformed return data through existing SDK error codes.
  • Documents balance lookup usage in README and API reference.

Testing

  • npm.cmd run typecheck - passed
  • npm.cmd run test:run - passed, 99 tests
  • npm.cmd run build - passed
  • npm.cmd run test:smoke - passed ESM/CJS/type smoke checks
  • npm.cmd run lint - exited 0 with existing repository warnings only
  • git diff --check - passed

Security / compatibility notes

  • Uses standard JSON-RPC eth_call only; it does not sign transactions or mutate chain state.
  • No secrets, private keys, API keys, or wallet credentials are logged or added.
  • Existing guild owner and role requirement stubs keep their current behavior.

@h1065153539-create h1065153539-create force-pushed the feat/token-balance-checks branch from 9e242cc to d2732fa Compare June 20, 2026 23:17
- rebase the token balance implementation onto current main
- resolve RPC and contract settings through getChainConfig
- preserve per-call contract and chain overrides
- keep chain-aware config tests passing alongside balance coverage
@h1065153539-create h1065153539-create force-pushed the feat/token-balance-checks branch from d2732fa to bf60ab8 Compare June 20, 2026 23:18
@h1065153539-create

Copy link
Copy Markdown
Contributor Author

Refreshed this PR at �f60ab80 on top of current main (�fa3297) after the chain-aware contract config landed.

What changed in the refresh:

  • Kept the token balance implementation, but now resolves
    pcUrl / contractAddress through getChainConfig(params.chainId).
  • Preserved per-call contractAddress overrides and added optional per-call chainId support.
  • Kept the newly merged chain config tests passing alongside balance-specific coverage.

Validation run locally:

pm run test:run -- tests/contracts.test.ts tests/client.test.ts -> 24 tests passed

pm run typecheck -> passed

pm run build -> passed

PR status after refresh: mergeable clean.

@Lakes41 Lakes41 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite good, Please resolve conflicts

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.

2 participants