BNB To FISH Swap
Use this flow when the agent wallet has BNB but does not yet have the FISH token needed for Openfish trading.
Do not treat BNB as a normal Bridge deposit asset. Sending native BNB to a Bridge deposit address does not directly credit Openfish FISH balance. BNB can become Openfish FISH only through the explicit swap quote and execute flow.
How It Works
Section titled “How It Works”- Create or reuse the wallet’s Bridge deposit address.
- Request a BNB -> FISH quote.
- Review the expected FISH amount, minimum output, slippage, price impact, required BNB, gas buffer, and quote expiry.
- If the quote says
hasEnoughBnb: false, fund the returneddepositAddresswith the required BNB and request a fresh quote. - Execute the quote only after explicit user confirmation.
- Poll swap status until it reaches
CREDITED. - Check the Openfish CLOB FISH balance before trading.
CLI Flow
Section titled “CLI Flow”Check the supported FISH token first:
openfish bridge supported-assetsQuote the swap:
openfish bridge swap quote 0xYourOpenfishWallet \ --amount-in-wei 1000000000000000 \ --to-token-address 0xaE71fd8baCc2f17C43a01C3F4aFF6dEEbc194444 \ --slippage-bps 300Review the quote fields before executing:
| Field | Meaning |
|---|---|
quoteId | Quote identifier used by execute. |
depositAddress | BSC address whose BNB balance will be used for the swap. |
estimatedAmountOutBaseUnit | Estimated FISH output in base units. |
minAmountOutBaseUnit | Minimum acceptable FISH output after slippage. |
slippageBps | Slippage tolerance in basis points. |
priceImpactBps | Estimated route price impact in basis points, when available. |
depositBnbBalanceWei | BNB currently available at the deposit address. |
requiredBnbWei | BNB needed for amount plus gas buffers. |
hasEnoughBnb | Whether execution can proceed with current BNB balance. |
expiresAt | Quote expiry time. |
If the user confirms the quote and hasEnoughBnb is true, execute:
openfish bridge swap execute 0xYourOpenfishWallet --quote-id <QUOTE_ID>Poll status:
openfish bridge swap status <SWAP_ID>openfish bridge swap list 0xYourOpenfishWalletopenfish clob balance --asset-type collateralREST Flow
Section titled “REST Flow”Quote:
curl -X POST "https://bridge.openfish.me/bridge/swap/quote" \ -H "Content-Type: application/json" \ -d '{ "address":"0xYourOpenfishWallet", "fromToken":"BNB", "toTokenAddress":"0xaE71fd8baCc2f17C43a01C3F4aFF6dEEbc194444", "amountInWei":"1000000000000000", "slippageBps":300 }'Execute:
curl -X POST "https://bridge.openfish.me/bridge/swap/execute" \ -H "Content-Type: application/json" \ -d '{ "address":"0xYourOpenfishWallet", "quoteId":"<QUOTE_ID>" }'Status:
curl "https://bridge.openfish.me/bridge/swap/<SWAP_ID>"curl "https://bridge.openfish.me/bridge/swaps?address=0xYourOpenfishWallet&limit=20"Status Values
Section titled “Status Values”| Status | Meaning |
|---|---|
SUBMITTED | Execute request accepted. |
SWAP_CONFIRMED | BNB -> FISH swap transaction was confirmed. |
SWEEP_SUBMITTED | FISH sweep from the deposit address was submitted. |
SWEPT | FISH sweep was confirmed. |
CREDITED | Openfish CLOB FISH balance was credited. |
FAILED | Swap failed; check the error field. |
EXPIRED | Quote or swap request expired. |
MANUAL_REVIEW | Manual review is required before the funds can be credited. |
Safety Rules
Section titled “Safety Rules”- Quote before execute.
- Do not execute an expired quote.
- Do not execute if
hasEnoughBnbis false. - Do not auto-swap from a generated agent; require explicit user confirmation.
- Do not send BNB as a normal deposit expecting direct FISH credit.
- Verify
openfish clob balance --asset-type collateralbefore live trading.
Next Steps
Section titled “Next Steps”- Deposit — Direct FISH deposit flow.
- Create Swap Quote — REST quote reference.
- Execute Swap — REST execute reference.
- Get Swap Status — REST status reference.