Skip to content

fix: normalize BGL bridge submit endpoint - #2

Open
tolga-tom-nook wants to merge 1 commit into
BitgesellOfficial:mainfrom
tolga-tom-nook:fix/bgl-bridge-endpoint-slash
Open

fix: normalize BGL bridge submit endpoint#2
tolga-tom-nook wants to merge 1 commit into
BitgesellOfficial:mainfrom
tolga-tom-nook:fix/bgl-bridge-endpoint-slash

Conversation

@tolga-tom-nook

Copy link
Copy Markdown

Summary

Normalizes the BGL bridge submit endpoint before appending /submit/bgl.

The default bridge endpoint includes a trailing slash:

this.bridgeEndpoint = config.bridgeEndpoint || 'https://bglswap.com/app/'

But _submitToBridge appended another slash:

`${this.bridgeEndpoint}/submit/bgl`

That produces https://bglswap.com/app//submit/bgl for the default/configured endpoint. This PR trims trailing slashes first so both https://bglswap.com/app/ and https://bglswap.com/app resolve to the canonical https://bglswap.com/app/submit/bgl URL.

Validation

Focused regression test:

npx jest src/__tests__/BGLBridgeEndpoint.test.ts --runInBand --coverage=false

Result:

PASS src/__tests__/BGLBridgeEndpoint.test.ts
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total

Targeted lint:

npx eslint src/bridge/BGL.ts src/__tests__/BGLBridgeEndpoint.test.ts --ext .ts

Result: passed.

Diff hygiene:

git diff --check

Result: clean.

Note: npm run build is currently blocked by the repo's dependency/toolchain mismatch after fresh install (@types/node requires disposable lib symbols not available to the pinned TypeScript 4.9 toolchain). The focused Jest regression and targeted ESLint pass for this change.

Bounty context: Bitgesell PR bounty/improvement program.

@MyTH-zyxeon

Copy link
Copy Markdown

Review assist for maintainers:

This looks like a focused bridge endpoint-normalization fix: _submitToBridge now trims trailing slashes from bridgeEndpoint before appending /submit/bgl, and the new Jest coverage exercises both trailing-slash and no-trailing-slash configurations against a mocked _post. I checked the patch scope and did not see wallet/key generation, transaction signing, provider/RPC, or live bridge submission behavior changes beyond URL construction.

Suggested merge checks:

  • Run the new BGLBridgeEndpoint Jest test and confirm it does not require real EVM/BGL keys, RPC access, or a live bridge endpoint because _post is mocked.
  • Add or manually verify edge cases for multiple trailing slashes if the SDK accepts arbitrary user-provided endpoint strings, since the implementation uses replace(/\/+$/, "").
  • Confirm the normalized URL preserves non-root path prefixes such as https://bglswap.com/app and does not change header/body payload construction.

Main acceptance criterion: bridge submissions should deterministically call exactly one /submit/bgl path segment for both bridgeEndpoint forms, without changing signing/key/runtime behavior.

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