Skip to main content

Withdrawal

Withdrawal is the process of moving funds from a TrexWallet account to an external blockchain address. This process is subject to network fees, AML/KYC checks, and may require manual approval for large amounts.

Key Steps

  1. User initiates a withdrawal request.
  2. System checks balance, permissions, and AML/KYC status.
  3. Withdrawal is queued and processed by the blockchain module.
  4. Network fee is calculated and deducted.
  5. Transaction is broadcast to the blockchain.
  6. Status is updated after confirmations.

Example API Call

POST /trex/v1/wallet/create_withdraw
Content-Type: application/json
Cookie: sid=...

{
"currency": "ETH",
"tokenNetwork": 1,
"amount": 0.5,
"fee": 0.001,
"address": "0x..."
}

The wallet is identified by the authenticated session. tokenNetwork is the terminal identifier returned by the terminal API. fee must match the server-quoted withdrawal fee; if it changes between preview and confirmation, the request is rejected and the caller must re-quote. Per-terminal AML and RequirePartnerInfo flags are evaluated server-side. Large amounts may require operator approval on the WithdrawApprove admin page.

Sending from a specific client address (EVM)

For EVM-based terminals (Ethereum, BNB Smart Chain with Base / ERC20 / BEP20 / EVM) two opt-in fields control the on-chain source:

  • requireClientAssetSource: true — pin the withdrawal to one of the user's own client addresses. The server auto-picks the first eligible address (sufficient asset + native gas, or HotApproved flow with hot spender). The platform never substitutes a plain hot-wallet source with a different on-chain asset owner.
  • sourceAddressId: "<int64>" — explicit address id from list_addresses, sent as a decimal string. Implies requireClientAssetSource=true. TrexWallet validates ownership (the address must belong to the wallet), security policy (not Disabled/Compromised/Reserve/ManualOnly/TestOnly), and balance/gas eligibility. If the chosen address cannot fund the withdrawal, the request is rejected with ClientAssetSourceNotAvailable. Non-EVM terminals reject this field with NotSupported before any OTP step.

To let the user pick which of their own addresses to use, the wallet UI calls list_addresses?includeTechnicalState=true — the per-address technicalState reports the on-chain amount of the asset, the native coin available for gas, hotApproved, and whether the backend currently supports pinned source for this terminal.