Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions clients/web3-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 4.1.0 - 2026-08-07

### Added (1)

- `getLatestBlockHeight()` (`GET /api/v1/dex/pre-transaction/block-height`)

### Changed (1)

- Added parameter `vendor`
- affected methods:
- `getAggregatedQuote()` (`GET /api/v1/dex/aggregator/quote`)

## 4.0.0 - 2026-07-29

### Changed (8)
Expand Down
17 changes: 17 additions & 0 deletions clients/web3-wallet/docs/GetLatestBlockHeightResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# GetLatestBlockHeightResponse


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **Integer** | Business status code. 0 indicates success; any non-zero value indicates a business error. | [optional] |
|**msg** | **String** | Status description message. | [optional] |
|**data** | [**GetLatestBlockHeightResponseData**](GetLatestBlockHeightResponseData.md) | | [optional] |
|**timestamp** | **Long** | Server response timestamp in milliseconds. | [optional] |
|**success** | **Boolean** | Convenience flag derived from `code == 0`. | [optional] |



15 changes: 15 additions & 0 deletions clients/web3-wallet/docs/GetLatestBlockHeightResponseData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


# GetLatestBlockHeightResponseData

Latest block height info.

## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**binanceChainId** | **String** | The chain identifier echoed back from the request. | [optional] |
|**blockHeight** | **Long** | Latest block height (slot for Solana) tracked by the Binance Web3 node. Represented as a 64-bit integer. | [optional] |



5 changes: 4 additions & 1 deletion clients/web3-wallet/docs/TradingApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ No authorization required

<a id="getAggregatedQuote"></a>
# **getAggregatedQuote**
> GetAggregatedQuoteResponse getAggregatedQuote(binanceChainId, amount, fromTokenAddress, toTokenAddress).recvWindow(recvWindow).nonce(nonce).userWalletAddress(userWalletAddress).feePercent(feePercent).feeSource(feeSource).execute();
> GetAggregatedQuoteResponse getAggregatedQuote(binanceChainId, amount, fromTokenAddress, toTokenAddress).recvWindow(recvWindow).nonce(nonce).vendor(vendor).userWalletAddress(userWalletAddress).feePercent(feePercent).feeSource(feeSource).execute();

Get Aggregated Quote

Expand All @@ -282,13 +282,15 @@ public class Example {
String toTokenAddress = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; // String | Buy-token contract address. Must differ from `fromTokenAddress`.
Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000).
String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted.
Vendor vendor = Vendor.fromValue("LiquidMesh"); // Vendor | Optional vendor selector. When provided, only the specified vendor is queried through the single-vendor fast path; the request bypasses the multi-vendor dual-window, early-return, and price-check logic. Values are case-sensitive and must be one of `LiquidMesh`, `Pancake`, or `Jupiter`. The vendor must also support the requested chain. An unsupported value or unavailable vendor/chain returns `PARAM_ERROR` (40001). When omitted, the API queries all applicable vendors in parallel and returns the aggregated routes.
String userWalletAddress = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"; // String | User wallet address. Required when quoting RFQ routes (equity / RWA tokens such as Ondo and BStock). This address is used as the receiver in the RFQ order and must match the wallet that signs `rfq.typedDataToSign` in the subsequent `/swap` call.
String feePercent = "1.5"; // String | Custom fee (referral fee / Add Fee) percentage as a decimal string. Must be paired with `feeSource` — either both present or both absent. **Range by chain:** `(0, 5]` for EVM chains (BSC, Ethereum, Base, etc.) and `(0, 10]` for Solana (`CT_501`) — greater than 0, up to the chain-specific maximum inclusive, max 2 decimal places. `\"1.5\"` means 1.5%. Values exceeding 2 decimal places are rejected with `INVALID_FEE_PERCENT` (40466). **`four.meme` tokens are not supported** — do not pass fee parameters when either side of the pair is a `four.meme` token.
FeeSource feeSource = FeeSource.fromValue("FROM_TOKEN"); // FeeSource | Fee deduction direction. `FROM_TOKEN` = deduct the fee from the sell token (the amount passed to the DEX is reduced to a net amount); `TO_TOKEN` = deduct the fee from the buy-token output (the user's actual received amount is reduced). Must be paired with `feePercent`.
try {
GetAggregatedQuoteResponse result = apiInstance.getAggregatedQuote(binanceChainId, amount, fromTokenAddress, toTokenAddress)
.recvWindow(recvWindow)
.nonce(nonce)
.vendor(vendor)
.userWalletAddress(userWalletAddress)
.feePercent(feePercent)
.feeSource(feeSource)
Expand All @@ -315,6 +317,7 @@ public class Example {
| **toTokenAddress** | **String**| Buy-token contract address. Must differ from &#x60;fromTokenAddress&#x60;. | |
| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] |
| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] |
| **vendor** | [**Vendor**](.md)| Optional vendor selector. When provided, only the specified vendor is queried through the single-vendor fast path; the request bypasses the multi-vendor dual-window, early-return, and price-check logic. Values are case-sensitive and must be one of &#x60;LiquidMesh&#x60;, &#x60;Pancake&#x60;, or &#x60;Jupiter&#x60;. The vendor must also support the requested chain. An unsupported value or unavailable vendor/chain returns &#x60;PARAM_ERROR&#x60; (40001). When omitted, the API queries all applicable vendors in parallel and returns the aggregated routes. | [optional] [enum: LiquidMesh] |
| **userWalletAddress** | **String**| User wallet address. Required when quoting RFQ routes (equity / RWA tokens such as Ondo and BStock). This address is used as the receiver in the RFQ order and must match the wallet that signs &#x60;rfq.typedDataToSign&#x60; in the subsequent &#x60;/swap&#x60; call. | [optional] |
| **feePercent** | **String**| Custom fee (referral fee / Add Fee) percentage as a decimal string. Must be paired with &#x60;feeSource&#x60; — either both present or both absent. **Range by chain:** &#x60;(0, 5]&#x60; for EVM chains (BSC, Ethereum, Base, etc.) and &#x60;(0, 10]&#x60; for Solana (&#x60;CT_501&#x60;) — greater than 0, up to the chain-specific maximum inclusive, max 2 decimal places. &#x60;\&quot;1.5\&quot;&#x60; means 1.5%. Values exceeding 2 decimal places are rejected with &#x60;INVALID_FEE_PERCENT&#x60; (40466). **&#x60;four.meme&#x60; tokens are not supported** — do not pass fee parameters when either side of the pair is a &#x60;four.meme&#x60; token. | [optional] |
| **feeSource** | [**FeeSource**](.md)| Fee deduction direction. &#x60;FROM_TOKEN&#x60; &#x3D; deduct the fee from the sell token (the amount passed to the DEX is reduced to a net amount); &#x60;TO_TOKEN&#x60; &#x3D; deduct the fee from the buy-token output (the user&#39;s actual received amount is reduced). Must be paired with &#x60;feePercent&#x60;. | [optional] [enum: FROM_TOKEN, TO_TOKEN] |
Expand Down
73 changes: 73 additions & 0 deletions clients/web3-wallet/docs/TransactionApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All URIs are relative to *https://web3.binance.com/build*
| [**getBroadcastOrders**](TransactionApi.md#getBroadcastOrders) | **GET** /api/v1/dex/post-transaction/orders | Get Broadcast Orders |
| [**getGasLimit**](TransactionApi.md#getGasLimit) | **POST** /api/v1/dex/pre-transaction/gas-limit | Get Gas Limit |
| [**getGasPrice**](TransactionApi.md#getGasPrice) | **GET** /api/v1/dex/pre-transaction/gas-price | Get Gas Price |
| [**getLatestBlockHeight**](TransactionApi.md#getLatestBlockHeight) | **GET** /api/v1/dex/pre-transaction/block-height | Get Latest Block Height |
| [**getTransactionSupportedChains**](TransactionApi.md#getTransactionSupportedChains) | **GET** /api/v1/dex/pre-transaction/supported/chain | Get Transaction Supported Chains |
| [**simulateTransactions**](TransactionApi.md#simulateTransactions) | **POST** /api/v1/dex/pre-transaction/simulate | Simulate Transactions |

Expand Down Expand Up @@ -314,6 +315,78 @@ No authorization required
| **403** | Forbidden. The API key does not have permission to access this endpoint. | - |
| **404** | Not Found. The requested resource or endpoint does not exist. | - |

<a id="getLatestBlockHeight"></a>
# **getLatestBlockHeight**
> GetLatestBlockHeightResponse getLatestBlockHeight(binanceChainId).recvWindow(recvWindow).nonce(nonce).execute();

Get Latest Block Height

Return the latest block height that the Binance Web3 node has synced to for the specified chain. Callers can use this to monitor node sync progress for risk control and detect when the node lags behind the canonical chain head.

### Example
```java
// Import classes:
import com.binance.connector.client.web3_wallet.ApiClient;
import com.binance.connector.client.web3_wallet.ApiException;
import com.binance.connector.client.web3_wallet.Configuration;
import com.binance.connector.client.web3_wallet.models.*;
import com.binance.connector.client.web3_wallet.rest.api.TransactionApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://web3.binance.com/build");

TransactionApi apiInstance = new TransactionApi(defaultClient);
String binanceChainId = "1"; // String | Unique chain identifier (e.g. \"1\"=Ethereum, \"56\"=BSC, \"CT_501\"=Solana, \"CT_195\"=Tron).
Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000).
String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted.
try {
GetLatestBlockHeightResponse result = apiInstance.getLatestBlockHeight(binanceChainId)
.recvWindow(recvWindow)
.nonce(nonce)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionApi#getLatestBlockHeight");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **binanceChainId** | **String**| Unique chain identifier (e.g. \&quot;1\&quot;&#x3D;Ethereum, \&quot;56\&quot;&#x3D;BSC, \&quot;CT_501\&quot;&#x3D;Solana, \&quot;CT_195\&quot;&#x3D;Tron). | |
| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] |
| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] |

### Return type

[**GetLatestBlockHeightResponse**](GetLatestBlockHeightResponse.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Latest block height for the specified chain. | - |
| **401** | Unauthorized. The request is missing or contains an invalid API key. | - |
| **403** | Forbidden. The API key does not have permission to access this endpoint. | - |
| **404** | Not Found. The requested resource or endpoint does not exist. | - |

<a id="getTransactionSupportedChains"></a>
# **getTransactionSupportedChains**
> GetTransactionSupportedChainsResponse getTransactionSupportedChains().recvWindow(recvWindow).nonce(nonce).execute();
Expand Down
4 changes: 3 additions & 1 deletion clients/web3-wallet/example_rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

[GET /api/v1/dex/aggregator/swap](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/trading-api#build-swap-transaction) - buildSwapTransaction - [BuildSwapTransactionExample.java:42](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/trading/BuildSwapTransactionExample.java#L42)

[GET /api/v1/dex/aggregator/quote](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/trading-api#get-aggregated-quote) - getAggregatedQuote - [GetAggregatedQuoteExample.java:39](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/trading/GetAggregatedQuoteExample.java#L39)
[GET /api/v1/dex/aggregator/quote](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/trading-api#get-aggregated-quote) - getAggregatedQuote - [GetAggregatedQuoteExample.java:40](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/trading/GetAggregatedQuoteExample.java#L40)

[GET /api/v1/dex/aggregator/supported/chain](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/trading-api#get-aggregator-supported-chains) - getAggregatorSupportedChains - [GetAggregatorSupportedChainsExample.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/trading/GetAggregatorSupportedChainsExample.java#L38)

Expand All @@ -86,6 +86,8 @@

[GET /api/v1/dex/pre-transaction/gas-price](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/transaction-api#get-gas-price) - getGasPrice - [GetGasPriceExample.java:42](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/transaction/GetGasPriceExample.java#L42)

[GET /api/v1/dex/pre-transaction/block-height](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/transaction-api#get-latest-block-height) - getLatestBlockHeight - [GetLatestBlockHeightExample.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/transaction/GetLatestBlockHeightExample.java#L38)

[GET /api/v1/dex/pre-transaction/supported/chain](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/transaction-api#get-transaction-supported-chains) - getTransactionSupportedChains - [GetTransactionSupportedChainsExample.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/transaction/GetTransactionSupportedChainsExample.java#L38)

[POST /api/v1/dex/pre-transaction/simulate](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/transaction-api#simulate-transactions) - simulateTransactions - [SimulateTransactionsExample.java:41](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/transaction/SimulateTransactionsExample.java#L41)
Expand Down
2 changes: 1 addition & 1 deletion clients/web3-wallet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>binance-web3-wallet</artifactId>
<name>web3-wallet</name>
<version>4.0.0</version>
<version>4.1.0</version>
<packaging>jar</packaging>

<parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ private static Class getClassByDiscriminator(
gsonBuilder.registerTypeAdapterFactory(
new com.binance.connector.client.web3_wallet.rest.model
.GetHotTokenListResponseDataItemsInner.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.binance.connector.client.web3_wallet.rest.model.GetLatestBlockHeightResponse
.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.binance.connector.client.web3_wallet.rest.model
.GetLatestBlockHeightResponseData.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.binance.connector.client.web3_wallet.rest.model.GetLeaderboardResponse
.CustomTypeAdapterFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class AddressPortfolioApi {

private static final String USER_AGENT =
String.format(
"binance-web3-wallet/4.0.0 (Java/%s; %s; %s)",
"binance-web3-wallet/4.1.0 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class GeneralDataApi {

private static final String USER_AGENT =
String.format(
"binance-web3-wallet/4.0.0 (Java/%s; %s; %s)",
"binance-web3-wallet/4.1.0 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RwaDataApi {

private static final String USER_AGENT =
String.format(
"binance-web3-wallet/4.0.0 (Java/%s; %s; %s)",
"binance-web3-wallet/4.1.0 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Loading
Loading