@mento-protocol/mento-sdk 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,16 +32,16 @@ const mento = await Mento.create(ChainId.CELO, yourPublicClient)
32
32
 
33
33
  The SDK is organized into service namespaces:
34
34
 
35
- | Service | Description |
36
- |---------|-------------|
37
- | `mento.tokens` | Query stable tokens and collateral assets |
38
- | `mento.pools` | Discover and inspect liquidity pools |
39
- | `mento.routes` | Find trading routes (direct and multi-hop) |
40
- | `mento.quotes` | Get expected swap output amounts |
41
- | `mento.swap` | Build swap transactions with approvals |
42
- | `mento.trading` | Check circuit breakers and trading limits |
43
- | `mento.liquidity` | Add/remove liquidity, zap in/out |
44
- | `mento.borrow` | Open, adjust, and close troves |
35
+ | Service | Description |
36
+ | ----------------- | ------------------------------------------ |
37
+ | `mento.tokens` | Query stable tokens and collateral assets |
38
+ | `mento.pools` | Discover and inspect liquidity pools |
39
+ | `mento.routes` | Find trading routes (direct and multi-hop) |
40
+ | `mento.quotes` | Get expected swap output amounts |
41
+ | `mento.swap` | Build swap transactions with approvals |
42
+ | `mento.trading` | Check circuit breakers and trading limits |
43
+ | `mento.liquidity` | Add/remove liquidity, zap in/out |
44
+ | `mento.borrow` | Open, adjust, and close troves |
45
45
 
46
46
  ## Token Queries
47
47
 
@@ -64,14 +64,10 @@ const amountIn = parseUnits('100', 18)
64
64
  const expectedOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn)
65
65
 
66
66
  // Build a swap transaction (includes approval if needed)
67
- const { approval, swap } = await mento.swap.buildSwapTransaction(
68
- USDm,
69
- CELO,
70
- amountIn,
71
- recipientAddress,
72
- ownerAddress,
73
- { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
74
- )
67
+ const { approval, swap } = await mento.swap.buildSwapTransaction(USDm, CELO, amountIn, recipientAddress, ownerAddress, {
68
+ slippageTolerance: 0.5,
69
+ deadline: deadlineFromMinutes(5),
70
+ })
75
71
 
76
72
  // Execute with any viem wallet client
77
73
  if (approval) {
@@ -94,6 +90,10 @@ const routes = await mento.routes.getRoutes()
94
90
  const freshRoutes = await mento.routes.getRoutes({ cached: false })
95
91
  ```
96
92
 
93
+ Automatically discovered routes use at most three hops. The SDK adds a
94
+ three-hop route only when the discovered pool graph has no direct or two-hop
95
+ path for the endpoint pair. Caller-supplied connected paths may be longer.
96
+
97
97
  ## Trading Status
98
98
 
99
99
  ```typescript
@@ -116,15 +116,24 @@ if (!status.circuitBreakerOk) {
116
116
  ```typescript
117
117
  // Add liquidity to a pool
118
118
  const addTx = await mento.liquidity.buildAddLiquidityTransaction(
119
- poolAddress, tokenA, amountA, tokenB, amountB,
120
- recipient, owner,
119
+ poolAddress,
120
+ tokenA,
121
+ amountA,
122
+ tokenB,
123
+ amountB,
124
+ recipient,
125
+ owner,
121
126
  { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
122
127
  )
123
128
 
124
129
  // Zap in with a single token
125
130
  const zapTx = await mento.liquidity.buildZapInTransaction(
126
- poolAddress, tokenIn, amountIn, 0.5, // split ratio
127
- recipient, owner,
131
+ poolAddress,
132
+ tokenIn,
133
+ amountIn,
134
+ 0.5, // split ratio
135
+ recipient,
136
+ owner,
128
137
  { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
129
138
  )
130
139
 
@@ -169,11 +178,7 @@ if (trove.status === 'zombie') {
169
178
  const params = await mento.borrow.getSystemParams('USDm')
170
179
 
171
180
  // Predict upfront fee before opening
172
- const fee = await mento.borrow.predictOpenTroveUpfrontFee(
173
- 'USDm',
174
- parseUnits('1000', 18),
175
- parseUnits('0.05', 18)
176
- )
181
+ const fee = await mento.borrow.predictOpenTroveUpfrontFee('USDm', parseUnits('1000', 18), parseUnits('0.05', 18))
177
182
  ```
178
183
 
179
184
  Notes:
@@ -184,13 +189,21 @@ Notes:
184
189
 
185
190
  ## Supported Chains
186
191
 
187
- | Chain | Chain ID | Constant |
188
- |-------|----------|----------|
189
- | Celo Mainnet | 42220 | `ChainId.CELO` |
190
- | Celo Sepolia | 11142220 | `ChainId.CELO_SEPOLIA` |
192
+ | Chain | Chain ID | Constant |
193
+ | ------------- | -------- | ----------------------- |
194
+ | Celo Mainnet | 42220 | `ChainId.CELO` |
195
+ | Celo Sepolia | 11142220 | `ChainId.CELO_SEPOLIA` |
196
+ | Monad | 143 | `ChainId.MONAD` |
197
+ | Monad Testnet | 10143 | `ChainId.MONAD_TESTNET` |
198
+ | Polygon | 137 | `ChainId.POLYGON` |
199
+ | Polygon Amoy | 80002 | `ChainId.POLYGON_AMOY` |
200
+ | Base Sepolia | 84532 | `ChainId.BASE_SEPOLIA` |
191
201
 
192
202
  ## Development
193
203
 
204
+ Architecture decisions live in [`docs/adrs`](docs/adrs/README.md). Implementation plans live in
205
+ [`docs/plans`](docs/plans/README.md).
206
+
194
207
  ```bash
195
208
  # Install dependencies
196
209
  pnpm install