Skip to content

fix: honor configured WBGL bridge endpoint#5

Open
newmattock wants to merge 3 commits into
BitgesellOfficial:mainfrom
newmattock:codex/wbgl-configured-endpoint
Open

fix: honor configured WBGL bridge endpoint#5
newmattock wants to merge 3 commits into
BitgesellOfficial:mainfrom
newmattock:codex/wbgl-configured-endpoint

Conversation

@newmattock
Copy link
Copy Markdown

Summary

  • Make WBGL honor config.bridgeEndpoint, matching BGL and the wrapper SDK behavior.
  • Add a focused regression test proving WBGL swap submission uses a configured bridge endpoint instead of always posting to the production default.

Verification

  • pnpm exec jest src/__tests__/WBGLEndpoint.test.ts --runInBand
  • pnpm exec tsc --noEmit --skipLibCheck --module commonjs --target es2019 --esModuleInterop --types jest src/bridge/WBGL.ts src/__tests__/WBGLEndpoint.test.ts
  • pnpm exec prettier --check src/__tests__/WBGLEndpoint.test.ts
  • git diff --check

Notes

  • I kept the production default unchanged: https://bglswap.com/app/.
  • I did not run the full project test suite because current upstream tests include focused live-bridge tests requiring environment credentials and network/gas-sensitive behavior; this PR uses a mocked bridge response and stubs the token send path.

Bounty context

Submitted for Bitgesell improvement bounty consideration: BitgesellOfficial/bitgesell#39.

@MyTH-zyxeon
Copy link
Copy Markdown

Maintainers: this looks like a good #39 / #81 candidate because WBGL currently appears to ignore config.bridgeEndpoint while the BGL side and wrapper SDK path can be configured. The diff keeps the production default unchanged and adds a focused mocked regression, so it is reviewable without touching live bridge funds.

Acceptance checks I would focus on:

  • Confirm trailing-slash behavior is intentional. The test uses https://bridge.example.test/app/ and expects /submit/wbgl; a config without the trailing slash may still produce a malformed endpoint unless callers normalize it elsewhere.
  • Confirm config.bridgeEndpoint || default should treat an empty string as default. If empty string should be rejected instead, this constructor is the right boundary to make that explicit.
  • The test stubs _sendWbgl and mocks fetch, which is a safe unit-level proof. Before merge, I would still want one non-secret dry-run or integration note showing the endpoint override path in a realistic SDK initialization.
  • No production default changed: https://bglswap.com/app/ remains the fallback.

No wallet keys, funding, live bridge calls, gas-sensitive actions, or secrets are involved in this review note.

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