Skip to content

Add BRIDGELESS_INIT env config for the swap referral id#6072

Merged
peachbits merged 1 commit into
developfrom
matthew/bridgeless-referral-env
Jul 14, 2026
Merged

Add BRIDGELESS_INIT env config for the swap referral id#6072
peachbits merged 1 commit into
developfrom
matthew/bridgeless-referral-env

Conversation

@peachbits

@peachbits peachbits commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Wires the Bridgeless swap plugin's new optional referralId init option through the GUI env config:

  • envConfig.ts: new BRIDGELESS_INIT cleaner — { referralId?: number } (uint16). Deliberately not asCorePluginInit: the plugin stays enabled by default when the key is absent (it was bridgeless: true before), and {}/{ referralId } both enable it.
  • corePlugins.ts: bridgeless: truebridgeless: ENV.BRIDGELESS_INIT, so the object reaches the plugin as its initOptions.

With no BRIDGELESS_INIT in env.json, behavior is identical to today (no referral in deposit payloads). Once Edge's referral id is provisioned on the Bridgeless registry, adding "BRIDGELESS_INIT": { "referralId": <uint16> } to env.json tags every Bridgeless deposit (EVM / Zano / BTC-BCH / Solana / TON) for referral revenue.

Companion to EdgeApp/edge-exchange-plugins referral + Solana/TON PRs.


Note

Low Risk
Config-only wiring for an already-enabled swap plugin; no change when BRIDGELESS_INIT is omitted.

Overview
Adds BRIDGELESS_INIT in envConfig.ts so an optional referralId (number) can be set in env.json and passed to the Bridgeless swap plugin as init options. The cleaner uses asOptional with a default of { referralId: undefined } instead of asCorePluginInit, so Bridgeless stays on by default when the key is missing (matching the previous bridgeless: true behavior).

corePlugins.ts now maps bridgeless: ENV.BRIDGELESS_INIT instead of bridgeless: true, forwarding the config object to the plugin. With no env entry, behavior is unchanged; setting "BRIDGELESS_INIT": { "referralId": <uint16> } tags Bridgeless deposits for referral revenue once Edge’s id is registered.

Reviewed by Cursor Bugbot for commit baeff17. Bugbot is set up for automated code reviews on this repo. Configure here.


@peachbits peachbits force-pushed the matthew/bridgeless-referral-env branch from 2cc39aa to baeff17 Compare July 14, 2026 07:39
@peachbits peachbits merged commit 32ac597 into develop Jul 14, 2026
6 of 7 checks passed
@peachbits peachbits deleted the matthew/bridgeless-referral-env branch July 14, 2026 07:42

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit baeff17. Configure here.

Comment thread src/envConfig.ts
referralId: asOptional(asNumber)
}).withRest,
{ referralId: undefined }
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Referral id lacks uint16 bounds

Low Severity

BRIDGELESS_INIT.referralId is documented as a uint16 but cleaned only with asNumber, so negatives, non-integers, and values above 65535 pass through. If Bridgeless encodes that field as a uint16 in deposit payloads, a bad env value can fail swaps or send an invalid referral tag once the id is configured.

Fix in Cursor Fix in Web

Triggered by project rule: Bugbot Review Rules

Reviewed by Cursor Bugbot for commit baeff17. Configure here.

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