Skip to content
xian99284-botPublic

About

flapai

Resources

Stars

56 stars

Watchers

0 watching

Forks

Repository files navigation

flap-fast-buy

Open-source Flap / Bangxt fast-buy CLI for BSC.

One process classifies Portal vs graduated AMM, encodes the buy, and submits through a sticky Binance Agentic Wallet host (baw-host) for low tip-to-submit latency.

Entry Path
Primary bangxt_fast_buy.mjs
Alias flap_fast_buy.mjs (same script)

Not financial advice. You run this at your own risk. Real broadcasts spend funds from your Agentic Wallet. Always dry-run with --preview-only first.

Requirements

  • Node.js >= 20
  • A working Binance Agentic Wallet install and session (baw logged in; @binance/agentic-wallet reachable via BAW_ENTRY or node_modules)
  • Network access to BSC JSON-RPC and Binance agent-wallet HTTP APIs

Install

git clone https://github.com/xian99284-bot/flapai.git
cd flapai
npm install
# Also install / link Binance Agentic Wallet so resolve works, e.g.:
#   npm install @binance/agentic-wallet
# or set BAW_ENTRY to its dist/index.js
cp .env.example .env   # then set BAW_WALLET=

Environment

See .env.example.

Variable Purpose
BAW_WALLET Your Agentic Wallet address (required for --broadcast / --preapprove; also via --wallet)
BAW_ENTRY Path to @binance/agentic-wallet/dist/index.js (optional if installed in node_modules)
BANGXT_RPC Preferred BSC RPC URL
BANGXT_BAW_SOCK Sticky host unix socket (default /tmp/bangxt-baw-host.sock)

Protocol constants (Portal / Factory / WBNB / BNCB) are public on-chain addresses and ship as defaults. No user wallet, cold wallet, or Agent ID is hardcoded.

Protocol addresses (public)

Role Address
Portal 0x49387D2E6cbF8FefE856e3FBc3E98a01aC3af062
Factory 0xC55820f24015bE7c4f18949D9e1363A3609B300e
WBNB 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
BNCB (preferred AMM quote when bal > 0) 0x4902C5ebc598265Ed2212b559B042De8a5Eeec3f

Quick start

# 1) Warm sticky host once (keeps TLS / session hot)
node bangxt_fast_buy.mjs --warm-daemon

# 2) Dry preview (no spend) — set BAW_WALLET in env or pass --wallet
export BAW_WALLET=0xYourAgenticWallet
node flap_fast_buy.mjs --token 0xTokenCA --amount 0.01b --preview-only

# Force AMM quote path dry:
node flap_fast_buy.mjs --token 0xTokenCA --force-amm --amount 0.01b --preview-only

# 3) Real buy (spends funds) — only after preview looks right
node flap_fast_buy.mjs --token 0xTokenCA --amount 0.01b --broadcast

# Max size from wallet quote balance (Portal quote or AMM BNCB/BNB):
node flap_fast_buy.mjs --token 0xTokenCA --max --broadcast

Safe default is preview-only. Pass --broadcast explicitly for a live buy.

Portal vs graduated AMM

  1. Resolve marketOfToken (with raced RPC + sticky failover).
  2. If a Portal market exists → encode buy (native BNB) or buyWithQuote (ERC-20 quote).
  3. If market == 0 (graduated) → cache it and run baw market-order swap in the same process (prefer BNCB if balance > 0, else native BNB).

Optional: --force-amm skips Portal classification.

Post-buy transfer (opt-in)

OSS does not auto-transfer by default (same as --no-transfer).

To transfer the bought ERC-20 after a successful broadcast:

node flap_fast_buy.mjs --token 0xCA --amount 0.01b --broadcast --transfer-to 0xDestination

There is no default destination address. If --transfer-to is omitted, transfer is skipped.

Latency knobs

Flag Effect
--warm-daemon Sticky HTTP baw-host on the unix socket
--local-host Skip sock; in-process sticky host only
--token-only / --skip-funding Skip allowance/balance probes
--skip-plan Skip buyPlanProbe; minShares=0
--transfer-to 0x… Opt-in post-buy ERC-20 transfer
--no-transfer Skip post-buy transfer (default)

See OPT.md for high-level tip-to-submit notes.

Amount semantics

Flag Meaning
--amount 0.001 Human units of the market quote
--amount 0.0001b / --bnb-equiv BNB-equivalent via WBNB/quote spot
--quote-amount 0.01 Explicit quote-token human amount
--max Wallet quote balance minus dust

Disclaimer

  • This software is provided as-is under the MIT License.
  • It is not financial, investment, or trading advice.
  • Binance Agentic Wallet is required for broadcast; you are responsible for wallet security, session files, and approvals.
  • Preview failures, reverts, slippage, and MEV are your risk. Test with --preview-only and small sizes first.

License

MIT — see LICENSE.

About

flapai

Resources

Stars

56 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages