sodax-sdk-backend-api
Installation
SKILL.md
Backend API (Core SDK granular skill)
Granular skill for BackendApiService — sodax.backendApi. HTTP client used by every feature for reads + swap-tx submission. Feature tag for errors varies by call site (e.g. 'swap' for submitSwapTx, 'moneyMarket' for MM reads); errors always carry error.context.api: 'backend'.
Step 1 — Clarify with user before coding
- New code or v1 → v2 port? Note: v2's load-bearing change is
Result-wrapping every method (v1 threw on failure). - Which category?
- Swap-related reads / writes:
submitSwapTx,getSubmitSwapTxStatus,getOrderbook,getIntentByHash,getIntentByTxHash,getUserIntents. - Money-market position reads:
getMoneyMarketPosition,getAllMoneyMarketAssets,getMoneyMarketAsset,getMoneyMarketAssetBorrowers,getMoneyMarketAssetSuppliers,getAllMoneyMarketBorrowers. - Config-API methods (implements
IConfigApi):getAllConfig,getChains,getSwapTokens,getSwapTokensByChainId,getMoneyMarketTokens,getMoneyMarketReserveAssets,getMoneyMarketTokensByChainId,getRelayChainIdMap.
- Swap-related reads / writes:
- Custom
IConfigApifor sandbox / fixtures? Every method must returnPromise<Result<T>>in v2.
Integration workflow
../integration/knowledge/ai-rules.md.../integration/knowledge/features/backend-api.md—BackendApiServiceAPI +submitSwapTxcall shape + custom-backend pattern.- For the
submitSwapTx+createIntentflow → also load../swap/SKILL.mdor read../integration/knowledge/features/swap.md§ "Backend submit-tx flow". - Errors carry
error.context.api === 'backend'→../integration/knowledge/recipes/result-and-errors.mdand../integration/knowledge/reference/error-codes.md.