@baseline-markets/sdk 1.0.0 → 1.0.2

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  A typed TypeScript SDK for interacting with [Baseline Protocol](https://baseline.markets) contracts via [viem](https://viem.sh).
4
4
 
5
- Baseline is an onchain AMM for leveraged tokens — `@baseline-markets/sdk` exposes a single `BaselineSDK` class covering token launches, swaps, borrowing, leverage, staking, and rewards.
5
+ Baseline is an onchain AMM for tokens with built-in liquidity — `@baseline-markets/sdk` exposes a single `BaselineSDK` class covering token launches, swaps, borrowing, leverage, staking, and rewards.
6
6
 
7
7
  ## Install
8
8
 
@@ -49,9 +49,9 @@ const quote = await sdk.quoteBuyExactOut(bToken, 100n);
49
49
  ### Swaps
50
50
 
51
51
  ```ts
52
- // Buy exactly 100 bTokens, capped at `quote.reservesIn` reserve in
53
- const hash = await sdk.buyTokensExactOut(bToken, 100n, quote.reservesIn, {
54
- wait: true,
52
+ // Buy exactly 100 bTokens, capped at `quote.amountIn` reserve in
53
+ const hash = await sdk.buyTokensExactOut(bToken, 100n, quote.amountIn, {
54
+ confirmations: 1,
55
55
  });
56
56
 
57
57
  // Sell 100 bTokens, accept at least `minOut` reserve out
@@ -62,9 +62,17 @@ const hash2 = await sdk.sellTokensExactIn(bToken, 100n, minOut);
62
62
 
63
63
  ```ts
64
64
  await sdk.deposit(bToken, collateral);
65
- await sdk.borrow(bToken, debtAmount);
66
- await sdk.leverage(bToken, collateral, targetLTV);
67
- await sdk.repay(bToken, debtAmount);
65
+ await sdk.borrow(bToken, debtAmount, recipient);
66
+
67
+ const leverageQuote = await sdk.quoteLeverage(bToken, collateralIn, leverageFactor);
68
+ await sdk.leverage(
69
+ bToken,
70
+ leverageQuote.targetCollateral,
71
+ collateralIn,
72
+ leverageQuote.maxSwapReservesIn,
73
+ );
74
+
75
+ await sdk.repay(bToken, reservesIn, recipient);
68
76
  await sdk.claim(bToken);
69
77
  ```
70
78
 
@@ -165,7 +173,7 @@ function BuyButton({ bToken, amount, maxIn }: {
165
173
 
166
174
  const buy = useMutation({
167
175
  mutationFn: () =>
168
- sdk!.buyTokensExactOut(bToken, amount, maxIn, { wait: true }),
176
+ sdk!.buyTokensExactOut(bToken, amount, maxIn, { confirmations: 1 }),
169
177
  onError: (err) => {
170
178
  if (err instanceof SDKError && err.kind === 'user_rejected') return;
171
179
  // surface other kinds: insufficient_funds, reverted, network, ...
@@ -183,7 +191,7 @@ function BuyButton({ bToken, amount, maxIn }: {
183
191
  }
184
192
  ```
185
193
 
186
- The `wait: true` option resolves the promise only after the receipt is mined, so `buy.isPending` covers both the wallet-prompt and the on-chain confirmation.
194
+ The `confirmations` option resolves the promise only after the receipt reaches the requested confirmation count, so `buy.isPending` covers both the wallet prompt and the on-chain confirmation.
187
195
 
188
196
  ## Configuration
189
197
 
@@ -191,7 +199,7 @@ The `wait: true` option resolves the promise only after the receipt is mined, so
191
199
 
192
200
  ```ts
193
201
  new BaselineSDK(publicClient, walletClient, {
194
- defaultUseNative: true, // wrap/unwrap ETH automatically for native-reserve pools
202
+ defaultUseNative: true, // use native ETH paths by default where supported
195
203
  });
196
204
  ```
197
205
 
package/dist/index.cjs CHANGED
@@ -5312,4 +5312,5 @@ var BaselineSDK = class _BaselineSDK {
5312
5312
 
5313
5313
  exports.BaselineSDK = BaselineSDK;
5314
5314
  exports.SDKError = SDKError;
5315
+ exports.abis = mercuryAbis;
5315
5316
  exports.supportedChainIds = supportedChainIds;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
2
+ export { mercuryAbis as abis } from '@baseline/contracts/abis';
2
3
 
3
4
  type CreateParams = {
4
5
  bToken: Address;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
2
+ export { mercuryAbis as abis } from '@baseline/contracts/abis';
2
3
 
3
4
  type CreateParams = {
4
5
  bToken: Address;
package/dist/index.js CHANGED
@@ -5308,4 +5308,4 @@ var BaselineSDK = class _BaselineSDK {
5308
5308
  }
5309
5309
  };
5310
5310
 
5311
- export { BaselineSDK, SDKError, supportedChainIds };
5311
+ export { BaselineSDK, SDKError, mercuryAbis as abis, supportedChainIds };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baseline-markets/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,6 +9,7 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
+ "source": "./index.ts",
12
13
  "types": "./dist/index.d.ts",
13
14
  "import": "./dist/index.js",
14
15
  "require": "./dist/index.cjs"