Quick Summary
- Function Renaming:
fetch*functions renamed toget*(e.g.,fetchQuotes→getQuotes) - Paymaster Architecture: Now uses starknet.js
PaymasterInterfaceinstead of SDK-internal handling executeSwapSignature: Changed from positional arguments to a single params object- DCA Service: Refactored with new
*ToCalls+execute*pattern - Type Changes:
Quote,Route,Page, and other types have structural changes - Slippage: Now expressed as decimal (0.01 = 1%) consistently
Prerequisites
Before migrating, ensure you have:Node.js >= 22 is required for SDK v4.0.0.
Breaking Changes
Swap Service
Function Renaming
| v3 Function | v4 Function | Notes |
|---|---|---|
fetchQuotes() | getQuotes() | Same functionality |
fetchSources() | getSources() | Same functionality |
fetchBuildExecuteTransaction() | quoteToCalls() | Returns AvnuCalls |
calculateMinAmount() | calculateMinReceivedAmount() | Slippage semantics changed |
New Function
calculateMaxSpendAmount(amount, slippage)- Calculate max spend amount for exactTokenTo swaps
Removed Functions
fetchPrices()- UsegetQuotes()or the new Impulse servicegetPrices()fetchBuildSwapTypedData()- Paymaster flow refactoredfetchExecuteSwapTransaction()- Paymaster flow refactored
executeSwap Signature Change
quoteToCalls Change
DCA Service
The DCA service has been refactored with a new pattern separating call building from execution.Function Renaming
| v3 Function | v4 Function |
|---|---|
fetchGetOrders() | getDcaOrders() |
fetchCreateOrder() | createDcaToCalls() |
fetchCancelOrder() | cancelDcaToCalls() |
executeCreateOrder() | executeCreateDca() |
executeCancelOrder() | executeCancelDca() |
Removed Functions
These low-level functions have been removed in favor of the new pattern:fetchEstimateFeeCreateOrder()fetchEstimateFeeCancelOrder()fetchBuildCreateOrderTypedData()fetchBuildCancelOrderTypedData()fetchExecuteCreateOrder()fetchExecuteCancelOrder()
Type Renaming
| v3 Type | v4 Type |
|---|---|
CreateOrderDto | CreateDcaOrder |
OrderReceipt | DcaOrder |
OrderStatus | DcaOrderStatus |
Trade | DcaTrade |
TradeStatus | DcaTradeStatus |
GetOrdersParams | GetDcaOrdersParams |
DCA Migration Example
Paymaster (Critical Change)
v3 Approach (Removed)
In v3, gasless transactions were handled internally by the SDK:v4 Approach (New)
In v4, you must use aPaymasterInterface from starknet.js:
New Paymaster Functions
The SDK now exposes dedicated paymaster functions for advanced use cases:buildPaymasterTransaction()- Build a transaction for the paymastersignPaymasterTransaction()- Sign the typed dataexecutePaymasterTransaction()- Execute the signed transactionexecuteAllPaymasterFlow()- Helper that chains all three steps
For detailed paymaster configuration, refer to the starknet.js documentation and the AVNU Paymaster docs.
Token Service
The token service has minimal breaking changes. New functions have been added:fetchTokenByAddress(tokenAddress)- Get a specific token by addressfetchVerifiedTokenBySymbol(symbol)- Get a verified token by symbol
Type Changes
Quote Type
Route Type
Source Type
SourceType Enum
Page<T> Type
Slippage Semantics
| Value | Meaning |
|---|---|
0.001 | 0.1% slippage |
0.005 | 0.5% slippage |
0.01 | 1% slippage |
0.05 | 5% slippage |
Gas Fees Denomination
In v3, thegasFees field in quotes was denominated in ETH (WEI). Starting from v4, gas fees are denominated in STRK (FRI).
New Features (Non-Breaking)
Impulse Service (Market Data)
New service for market data, prices, volume, and TVL:Staking Service
New service for AVNU stake delegation:Zod Validation
All API responses are now validated and transformed using Zod schemas:- Automatic hex string to BigInt conversion
- Automatic ISO string to Date conversion
- Runtime type safety
Migration Checklist
1
Update Dependencies
2
Update Function Imports
Replace
fetch* imports with get*:3
Update executeSwap Calls
Change from positional arguments to params object:
4
Update Paymaster Integration
If using gasless transactions, implement
PaymasterInterface from starknet.js.5
Update DCA Calls
Replace old DCA functions with new pattern:
fetchGetOrders→getDcaOrdersexecuteCreateOrder→executeCreateDcaexecuteCancelOrder→executeCancelDca
6
Update Type References
Page.number→Page.pageRoute.routeInfois nowRecord<string, string>instead ofMap- Access fees via
quote.feeinstead of individual fee fields
7
Verify Slippage Values
Ensure all slippage values are decimals (0.01 = 1%).
8
Test Your Integration
Run your test suite and verify all functionality works as expected.
Troubleshooting
TypeError: fetchQuotes is not a function
TypeError: fetchQuotes is not a function
The function has been renamed to
getQuotes. Update your import:TypeError: Cannot read property 'number' of undefined
TypeError: Cannot read property 'number' of undefined
The
Page type’s number field has been renamed to page:Gasless transactions not working
Gasless transactions not working
Gasless handling has moved to starknet.js
PaymasterInterface. You need to:- Create a
PaymasterInterfaceimplementation - Pass it via the
paymasterparameter
Type error on Quote.avnuFees
Type error on Quote.avnuFees
Fee fields are now consolidated under
quote.fee:Route.routeInfo type mismatch
Route.routeInfo type mismatch
routeInfo changed from Map<string, string> to Record<string, string>: