defi-dash-sdk 0.1.0 → 0.1.1

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.
Files changed (50) hide show
  1. package/README.md +172 -138
  2. package/dist/index.d.ts +25 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +45 -3
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/utils/index.d.ts +1 -0
  7. package/dist/lib/utils/index.d.ts.map +1 -1
  8. package/dist/lib/utils/index.js +1 -0
  9. package/dist/lib/utils/index.js.map +1 -1
  10. package/dist/lib/utils/logger.d.ts +30 -0
  11. package/dist/lib/utils/logger.d.ts.map +1 -0
  12. package/dist/lib/utils/logger.js +142 -0
  13. package/dist/lib/utils/logger.js.map +1 -0
  14. package/dist/protocols/index.d.ts +7 -0
  15. package/dist/protocols/index.d.ts.map +1 -0
  16. package/dist/protocols/index.js +11 -0
  17. package/dist/protocols/index.js.map +1 -0
  18. package/dist/protocols/interface.d.ts +102 -0
  19. package/dist/protocols/interface.d.ts.map +1 -0
  20. package/dist/protocols/interface.js +8 -0
  21. package/dist/protocols/interface.js.map +1 -0
  22. package/dist/protocols/navi.d.ts +36 -0
  23. package/dist/protocols/navi.d.ts.map +1 -0
  24. package/dist/protocols/navi.js +187 -0
  25. package/dist/protocols/navi.js.map +1 -0
  26. package/dist/protocols/suilend.d.ts +38 -0
  27. package/dist/protocols/suilend.d.ts.map +1 -0
  28. package/dist/protocols/suilend.js +188 -0
  29. package/dist/protocols/suilend.js.map +1 -0
  30. package/dist/sdk.d.ts +101 -0
  31. package/dist/sdk.d.ts.map +1 -0
  32. package/dist/sdk.js +297 -0
  33. package/dist/sdk.js.map +1 -0
  34. package/dist/strategies/deleverage.d.ts +46 -0
  35. package/dist/strategies/deleverage.d.ts.map +1 -0
  36. package/dist/strategies/deleverage.js +115 -0
  37. package/dist/strategies/deleverage.js.map +1 -0
  38. package/dist/strategies/index.d.ts +6 -0
  39. package/dist/strategies/index.d.ts.map +1 -0
  40. package/dist/strategies/index.js +13 -0
  41. package/dist/strategies/index.js.map +1 -0
  42. package/dist/strategies/leverage.d.ts +43 -0
  43. package/dist/strategies/leverage.d.ts.map +1 -0
  44. package/dist/strategies/leverage.js +133 -0
  45. package/dist/strategies/leverage.js.map +1 -0
  46. package/dist/types.d.ts +117 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +24 -0
  49. package/dist/types.js.map +1 -0
  50. package/package.json +27 -24
package/README.md CHANGED
@@ -1,210 +1,244 @@
1
- # DeFi Dash SDK
1
+ # DefiDash SDK
2
2
 
3
- > Multi-protocol DeFi SDK for Sui blockchain - leverage strategies, flash loans, and lending protocols
3
+ Multi-protocol DeFi SDK for Sui blockchain **leverage lending strategies** with minimal friction.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/defi-dash-sdk.svg)](https://www.npmjs.com/package/defi-dash-sdk)
6
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
+ ## Why Leverage Lending?
7
6
 
8
- ## Features
7
+ **Leverage lending is a powerful DeFi primitive for long-term asset appreciation.**
9
8
 
10
- - 🔧 **Utility Functions** - Token formatting, coin type normalization
11
- - 🏦 **Protocol Wrappers** - Scallop, Suilend integration
12
- - 🔄 **Leverage Strategies** - One-click leverage long positions
13
- - ⚡ **Type-Safe** - Full TypeScript support
9
+ If you believe certain assets like **BTC** will trend upward over time despite short-term volatility, leverage lending allows you to:
14
10
 
15
- ---
11
+ - **Multiply your profit exposure** — instead of holding 1x BTC, hold 2x or 3x
12
+ - **Maintain a stable position** — unlike perpetual futures, no funding rates eating into your position
13
+ - **Lower costs** — no recurring fees, only the spread between borrow/supply APY
14
+ - **Composable on-chain** — fully transparent, no CEX counterparty risk
16
15
 
17
- ## Installation
16
+ ### Leverage Lending vs Perpetual Futures
18
17
 
19
- ```bash
20
- npm install defi-dash-sdk
21
- # or
22
- yarn add defi-dash-sdk
23
- ```
18
+ | Aspect | Leverage Lending | Perpetual Futures |
19
+ | --------------------- | ----------------------- | ------------------------ |
20
+ | **Funding Rate** | None | -0.01% ~ +0.03% every 8h |
21
+ | **Ongoing Costs** | Borrow APY - Supply APY | Funding + Trading Fees |
22
+ | **Liquidation** | Collateral-based LTV | Margin-based |
23
+ | **Counterparty** | On-chain protocol | Exchange (CEX/DEX) |
24
+ | **Position Duration** | Unlimited | Funding rate dependent |
24
25
 
25
- ---
26
+ > **TL;DR**: If you're bullish on an asset long-term, leverage lending is more capital-efficient than perpetual futures.
26
27
 
27
- ## Quick Start
28
+ ---
28
29
 
29
- ### 1. Basic Usage - Utility Functions
30
+ ## What is DefiDash SDK?
30
31
 
31
- ```typescript
32
- import { formatUnits, parseUnits, normalizeCoinType } from 'defi-dash-sdk';
32
+ DefiDash SDK is a **DeFi Saver-like toolkit** for Sui blockchain. It abstracts complex multi-protocol interactions into simple function calls.
33
33
 
34
- // Format token amounts
35
- const humanReadable = formatUnits(1000000, 6); // "1" (USDC)
36
- const rawAmount = parseUnits("1.5", 6); // 1500000n
34
+ ### Architecture
37
35
 
38
- // Normalize coin types
39
- const normalized = normalizeCoinType("0x2::sui::SUI");
40
- // "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
41
36
  ```
42
-
43
- ### 2. Using Type Definitions
44
-
45
- ```typescript
46
- import type { MarketReserve } from 'defi-dash-sdk';
47
-
48
- const reserve: MarketReserve = {
49
- coinType: "0x2::sui::SUI",
50
- id: "0x...",
51
- decimals: 9,
52
- symbol: "SUI"
53
- };
37
+ ┌──────────────────────────────────────────────────────────────────────┐
38
+ │ Leverage Strategy (Single PTB) │
39
+ ├──────────────────────────────────────────────────────────────────────┤
40
+ │ │
41
+ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
42
+ │ │ 1. Flash Loan │───▶│ 2. Swap │───▶│ 3. Lending │ │
43
+ │ │ (Scallop) │ │ (7k Protocol) │ │ (Suilend/Navi)│ │
44
+ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
45
+ │ │ │ │
46
+ │ └────────────── Borrow to Repay ◀──────────────┘ │
47
+ │ │
48
+ └──────────────────────────────────────────────────────────────────────┘
54
49
  ```
55
50
 
56
- ---
57
-
58
- ## API Reference
59
-
60
- ### Utilities
51
+ **How it works:**
61
52
 
62
- #### `formatUnits(amount, decimals): string`
53
+ 1. **Flash Loan** — Borrow USDC from Scallop (no collateral needed)
54
+ 2. **Swap** — Convert USDC to collateral asset (LBTC, SUI, etc.) via 7k Aggregator
55
+ 3. **Deposit** — Deposit collateral into lending protocol (Suilend or Navi)
56
+ 4. **Borrow** — Borrow USDC against collateral to repay flash loan
63
57
 
64
- Converts raw token amount to human-readable format.
58
+ All steps execute atomically in a single Sui Programmable Transaction Block (PTB).
65
59
 
66
- **Parameters:**
67
-
68
- - `amount` - Raw amount (string | number | bigint)
69
- - `decimals` - Token decimals (e.g., 6 for USDC, 9 for SUI)
70
-
71
- **Returns:** Formatted string with proper decimal placement
60
+ ---
72
61
 
73
- **Example:**
62
+ ## Installation
74
63
 
75
- ```typescript
76
- formatUnits(1500000, 6) // "1.5"
77
- formatUnits(1000000000, 9) // "1"
64
+ ```bash
65
+ npm install defi-dash-sdk
78
66
  ```
79
67
 
80
- #### `parseUnits(amount, decimals): bigint`
81
-
82
- Converts human-readable amount to raw units.
83
-
84
- **Parameters:**
85
-
86
- - `amount` - Human-readable amount string
87
- - `decimals` - Token decimals
88
-
89
- **Returns:** Raw amount as bigint
90
-
91
- **Example:**
68
+ ## Quick Start
92
69
 
93
70
  ```typescript
94
- parseUnits("1.5", 6) // 1500000n
71
+ import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
72
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
73
+ import { DefiDashSDK, LendingProtocol } from "defi-dash-sdk";
74
+
75
+ // Initialize
76
+ const suiClient = new SuiClient({ url: getFullnodeUrl("mainnet") });
77
+ const keypair = Ed25519Keypair.fromSecretKey(YOUR_SECRET_KEY);
78
+
79
+ const sdk = new DefiDashSDK();
80
+ await sdk.initialize(suiClient, keypair);
81
+
82
+ // Execute 2x leverage on LBTC
83
+ const result = await sdk.leverage({
84
+ protocol: LendingProtocol.Suilend,
85
+ depositAsset: "LBTC",
86
+ depositAmount: "0.001", // Human-readable
87
+ multiplier: 2.0,
88
+ dryRun: false, // Set true to simulate
89
+ });
90
+
91
+ console.log(result.txDigest); // Transaction hash
92
+
93
+ // Close position
94
+ await sdk.deleverage({
95
+ protocol: LendingProtocol.Suilend,
96
+ dryRun: false,
97
+ });
95
98
  ```
96
99
 
97
- #### `normalizeCoinType(coinType): string`
98
-
99
- Normalizes Sui coin type addresses (pads to 64 chars, ensures 0x prefix).
100
+ ---
100
101
 
101
- #### `formatCoinType(type): string`
102
+ ## Supported Protocols
102
103
 
103
- Uses `normalizeStructTag` from `@mysten/sui` with fallback.
104
+ | Component | Protocols |
105
+ | ------------------- | ------------- |
106
+ | **Flash Loan** | Scallop |
107
+ | **Swap Aggregator** | 7k Protocol |
108
+ | **Lending** | Suilend, Navi |
104
109
 
105
110
  ---
106
111
 
107
- ## Development
108
-
109
- This package is designed for both Node.js scripts and frontend applications.
110
-
111
- ### For Testing Strategies
112
+ ## Examples
112
113
 
113
- Clone the repo to access example scripts:
114
+ See `examples/` folder for full working examples:
114
115
 
115
116
  ```bash
116
- git clone https://github.com/yourusername/defi-dash-sdk.git
117
- cd defi-dash-sdk
118
- npm install
119
-
120
- # Run example leverage strategy
121
- npm run test:suilend-leverage
122
- ```
117
+ # Setup environment
118
+ cp .env.example .env.test
119
+ # Edit .env.test with your secret key
123
120
 
124
- ### Building from Source
121
+ # Run leverage example (dry run by default)
122
+ npm run example:leverage
125
123
 
126
- ```bash
127
- npm run build # Compiles TypeScript to dist/
124
+ # Run deleverage example
125
+ npm run example:deleverage
128
126
  ```
129
127
 
130
- ---
131
-
132
- ## Architecture
128
+ ### Environment Variables
133
129
 
134
- ```
135
- defi-dash-sdk/
136
- ├── src/
137
- │ ├── index.ts # SDK entry point
138
- │ └── lib/
139
- │ ├── utils/ # Formatting & normalization
140
- │ ├── scallop/ # Flash loan wrapper
141
- │ └── suilend/ # Lending constants
142
- └── tests/ # Integration examples
143
- ```
130
+ | Variable | Description | Default |
131
+ | ---------------------------- | ------------------------------ | --------- |
132
+ | `SECRET_KEY` | Sui wallet secret key (base64) | Required |
133
+ | `LEVERAGE_PROTOCOL` | `suilend` or `navi` | `suilend` |
134
+ | `LEVERAGE_DEPOSIT_COIN_TYPE` | Asset symbol or coin type | `LBTC` |
135
+ | `LEVERAGE_DEPOSIT_AMOUNT` | Amount in raw units | `1000` |
136
+ | `LEVERAGE_MULTIPLIER` | Leverage multiplier | `2` |
137
+ | `TX_MODE` | `dryrun` or `exec` | `dryrun` |
144
138
 
145
139
  ---
146
140
 
147
- ## Examples
141
+ ## API Reference
148
142
 
149
- ### Using in a Frontend (React/Next.js)
143
+ ### `DefiDashSDK`
150
144
 
151
145
  ```typescript
152
- import { formatUnits, normalizeCoinType } from 'defi-dash-sdk';
146
+ class DefiDashSDK {
147
+ // Initialize with Sui client and keypair
148
+ initialize(suiClient: SuiClient, keypair: Ed25519Keypair): Promise<void>;
149
+
150
+ // Open leveraged position
151
+ leverage(params: LeverageParams): Promise<StrategyResult>;
153
152
 
154
- function TokenBalance({ amount, decimals, symbol }) {
155
- const formatted = formatUnits(amount, decimals);
153
+ // Close leveraged position
154
+ deleverage(params: DeleverageParams): Promise<StrategyResult>;
156
155
 
157
- return <div>{formatted} {symbol}</div>;
156
+ // Get current position
157
+ getPosition(protocol: LendingProtocol): Promise<PositionInfo | null>;
158
+
159
+ // Preview leverage before execution
160
+ previewLeverage(params): Promise<LeveragePreview>;
158
161
  }
159
162
  ```
160
163
 
161
- ### Using in a Node.js Script
164
+ ### Types
162
165
 
163
166
  ```typescript
164
- import { parseUnits } from 'defi-dash-sdk';
167
+ enum LendingProtocol {
168
+ Suilend = "suilend",
169
+ Navi = "navi",
170
+ }
165
171
 
166
- const depositAmount = parseUnits("100", 6); // 100 USDC
167
- console.log(`Depositing: ${depositAmount} raw units`);
172
+ interface LeverageParams {
173
+ protocol: LendingProtocol;
174
+ depositAsset: string; // "LBTC" or full coin type
175
+ depositAmount: string; // Human-readable, e.g., "0.001"
176
+ multiplier: number; // 1.5, 2.0, 3.0, etc.
177
+ dryRun?: boolean;
178
+ }
179
+
180
+ interface StrategyResult {
181
+ success: boolean;
182
+ txDigest?: string;
183
+ gasUsed?: bigint;
184
+ error?: string;
185
+ }
168
186
  ```
169
187
 
170
188
  ---
171
189
 
172
- ## Protocol Support
173
-
174
- | Protocol | Type | Status |
175
- | ----------- | ----------------- | -------------- |
176
- | Scallop | Flash Loans | ✅ Supported |
177
- | Suilend | Lending/Borrowing | ✅ Supported |
178
- | 7k Protocol | Swap Aggregator | ✅ Supported |
179
- | NAVI | Lending | 🚧 In Progress |
190
+ ## Development Scripts
180
191
 
181
- ---
182
-
183
- ## Dependencies
192
+ For debugging and testing individual protocol integrations:
184
193
 
185
- Core dependencies (automatically installed):
194
+ ```bash
195
+ # Setup
196
+ cp .env.scripts.example .env.scripts
186
197
 
187
- - `@mysten/sui` - Sui blockchain SDK
188
- - `@suilend/sdk` - Suilend protocol
189
- - `@scallop-io/sui-scallop-sdk` - Scallop flash loans
190
- - `@7kprotocol/sdk-ts` - 7k swap aggregator
198
+ # Suilend scripts
199
+ npm run script:suilend-leverage
200
+ npm run script:suilend-deleverage
191
201
 
192
- ---
202
+ # Navi scripts
203
+ npm run script:navi-leverage
204
+ npm run script:navi-deleverage
193
205
 
194
- ## Contributing
206
+ # Scallop flash loan
207
+ npm run script:scallop-flashloan
195
208
 
196
- Contributions are welcome! Please open an issue or PR.
209
+ # 7k swap
210
+ npm run script:swap
211
+ ```
197
212
 
198
213
  ---
199
214
 
200
- ## License
215
+ ## Project Structure
201
216
 
202
- ISC
217
+ ```
218
+ defi-dash-sdk/
219
+ ├── src/
220
+ │ ├── index.ts # SDK entry point
221
+ │ ├── sdk.ts # DefiDashSDK class
222
+ │ ├── types.ts # TypeScript types
223
+ │ ├── protocols/ # Protocol adapters
224
+ │ │ ├── suilend.ts
225
+ │ │ └── navi.ts
226
+ │ ├── strategies/ # Strategy builders
227
+ │ │ ├── leverage.ts
228
+ │ │ └── deleverage.ts
229
+ │ └── lib/ # Utilities
230
+ ├── examples/ # SDK usage examples
231
+ │ ├── leverage.ts
232
+ │ └── deleverage.ts
233
+ └── scripts/ # Development scripts
234
+ ├── suilend/
235
+ ├── navi/
236
+ ├── scallop/
237
+ └── 7k/
238
+ ```
203
239
 
204
240
  ---
205
241
 
206
- ## Links
242
+ ## License
207
243
 
208
- - [Documentation](#) (Coming Soon)
209
- - [GitHub Repository](#)
210
- - [Example Apps](#)
244
+ MIT
package/dist/index.d.ts CHANGED
@@ -5,8 +5,31 @@
5
5
  * flash loans, and lending protocols.
6
6
  *
7
7
  * @module defi-dash-sdk
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { DefiDashSDK, LendingProtocol } from 'defi-dash-sdk';
12
+ *
13
+ * const sdk = new DefiDashSDK();
14
+ * await sdk.initialize(suiClient, keypair);
15
+ *
16
+ * // Leverage strategy
17
+ * const result = await sdk.leverage({
18
+ * protocol: LendingProtocol.Suilend,
19
+ * depositAsset: 'LBTC',
20
+ * depositAmount: '0.001',
21
+ * multiplier: 2.0,
22
+ * dryRun: true
23
+ * });
24
+ * ```
8
25
  */
26
+ export { DefiDashSDK } from "./sdk";
27
+ export { LendingProtocol, LeverageParams, DeleverageParams, PositionInfo, AssetPosition, StrategyResult, LeveragePreview, SDKOptions, USDC_COIN_TYPE, SUI_COIN_TYPE, } from "./types";
28
+ export { ILendingProtocol, ReserveInfo } from "./protocols/interface";
29
+ export { SuilendAdapter } from "./protocols/suilend";
30
+ export { NaviAdapter } from "./protocols/navi";
31
+ export { buildLeverageTransaction, calculateLeveragePreview, buildDeleverageTransaction, calculateDeleverageEstimate, } from "./strategies";
9
32
  export * from "./lib/utils";
10
- export * from "./lib/scallop";
11
- export type { MarketReserve } from "./lib/suilend/const";
33
+ export { ScallopFlashLoanClient } from "./lib/scallop";
34
+ export { COIN_TYPES, SUILEND_RESERVES, getReserveByCoinType, } from "./lib/suilend/const";
12
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC;AAG9B,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -6,6 +6,23 @@
6
6
  * flash loans, and lending protocols.
7
7
  *
8
8
  * @module defi-dash-sdk
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { DefiDashSDK, LendingProtocol } from 'defi-dash-sdk';
13
+ *
14
+ * const sdk = new DefiDashSDK();
15
+ * await sdk.initialize(suiClient, keypair);
16
+ *
17
+ * // Leverage strategy
18
+ * const result = await sdk.leverage({
19
+ * protocol: LendingProtocol.Suilend,
20
+ * depositAsset: 'LBTC',
21
+ * depositAmount: '0.001',
22
+ * multiplier: 2.0,
23
+ * dryRun: true
24
+ * });
25
+ * ```
9
26
  */
10
27
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
28
  if (k2 === undefined) k2 = k;
@@ -22,8 +39,33 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
39
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
40
  };
24
41
  Object.defineProperty(exports, "__esModule", { value: true });
25
- // Utility functions
42
+ exports.getReserveByCoinType = exports.SUILEND_RESERVES = exports.COIN_TYPES = exports.ScallopFlashLoanClient = exports.calculateDeleverageEstimate = exports.buildDeleverageTransaction = exports.calculateLeveragePreview = exports.buildLeverageTransaction = exports.NaviAdapter = exports.SuilendAdapter = exports.SUI_COIN_TYPE = exports.USDC_COIN_TYPE = exports.LendingProtocol = exports.DefiDashSDK = void 0;
43
+ // Main SDK
44
+ var sdk_1 = require("./sdk");
45
+ Object.defineProperty(exports, "DefiDashSDK", { enumerable: true, get: function () { return sdk_1.DefiDashSDK; } });
46
+ // Types and Enums
47
+ var types_1 = require("./types");
48
+ Object.defineProperty(exports, "LendingProtocol", { enumerable: true, get: function () { return types_1.LendingProtocol; } });
49
+ Object.defineProperty(exports, "USDC_COIN_TYPE", { enumerable: true, get: function () { return types_1.USDC_COIN_TYPE; } });
50
+ Object.defineProperty(exports, "SUI_COIN_TYPE", { enumerable: true, get: function () { return types_1.SUI_COIN_TYPE; } });
51
+ var suilend_1 = require("./protocols/suilend");
52
+ Object.defineProperty(exports, "SuilendAdapter", { enumerable: true, get: function () { return suilend_1.SuilendAdapter; } });
53
+ var navi_1 = require("./protocols/navi");
54
+ Object.defineProperty(exports, "NaviAdapter", { enumerable: true, get: function () { return navi_1.NaviAdapter; } });
55
+ // Strategy Builders (for advanced usage)
56
+ var strategies_1 = require("./strategies");
57
+ Object.defineProperty(exports, "buildLeverageTransaction", { enumerable: true, get: function () { return strategies_1.buildLeverageTransaction; } });
58
+ Object.defineProperty(exports, "calculateLeveragePreview", { enumerable: true, get: function () { return strategies_1.calculateLeveragePreview; } });
59
+ Object.defineProperty(exports, "buildDeleverageTransaction", { enumerable: true, get: function () { return strategies_1.buildDeleverageTransaction; } });
60
+ Object.defineProperty(exports, "calculateDeleverageEstimate", { enumerable: true, get: function () { return strategies_1.calculateDeleverageEstimate; } });
61
+ // Utilities
26
62
  __exportStar(require("./lib/utils"), exports);
27
- // Protocol wrappers
28
- __exportStar(require("./lib/scallop"), exports);
63
+ // Flash Loan
64
+ var scallop_1 = require("./lib/scallop");
65
+ Object.defineProperty(exports, "ScallopFlashLoanClient", { enumerable: true, get: function () { return scallop_1.ScallopFlashLoanClient; } });
66
+ // Constants
67
+ var const_1 = require("./lib/suilend/const");
68
+ Object.defineProperty(exports, "COIN_TYPES", { enumerable: true, get: function () { return const_1.COIN_TYPES; } });
69
+ Object.defineProperty(exports, "SUILEND_RESERVES", { enumerable: true, get: function () { return const_1.SUILEND_RESERVES; } });
70
+ Object.defineProperty(exports, "getReserveByCoinType", { enumerable: true, get: function () { return const_1.getReserveByCoinType; } });
29
71
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAEH,oBAAoB;AACpB,8CAA4B;AAE5B,oBAAoB;AACpB,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;;;;;;;;;;AAEH,WAAW;AACX,6BAAoC;AAA3B,kGAAA,WAAW,OAAA;AAEpB,kBAAkB;AAClB,iCAWiB;AAVf,wGAAA,eAAe,OAAA;AAQf,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AAKf,+CAAqD;AAA5C,yGAAA,cAAc,OAAA;AACvB,yCAA+C;AAAtC,mGAAA,WAAW,OAAA;AAEpB,yCAAyC;AACzC,2CAKsB;AAJpB,sHAAA,wBAAwB,OAAA;AACxB,sHAAA,wBAAwB,OAAA;AACxB,wHAAA,0BAA0B,OAAA;AAC1B,yHAAA,2BAA2B,OAAA;AAG7B,YAAY;AACZ,8CAA4B;AAE5B,aAAa;AACb,yCAAuD;AAA9C,iHAAA,sBAAsB,OAAA;AAE/B,YAAY;AACZ,6CAI6B;AAH3B,mGAAA,UAAU,OAAA;AACV,yGAAA,gBAAgB,OAAA;AAChB,6GAAA,oBAAoB,OAAA"}
@@ -5,4 +5,5 @@
5
5
  */
6
6
  export * from "./format";
7
7
  export * from "./coin";
8
+ export * from "./logger";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -21,4 +21,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  __exportStar(require("./format"), exports);
23
23
  __exportStar(require("./coin"), exports);
24
+ __exportStar(require("./logger"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * DeFi Dash SDK - Logging Utilities
3
+ *
4
+ * Common logging functions for test scripts
5
+ */
6
+ import { PositionInfo, LeveragePreview, StrategyResult } from "../../types";
7
+ export declare function formatAmount(amount: bigint | number, decimals: number): string;
8
+ export declare function formatUsd(value: number): string;
9
+ export declare function formatGas(gasUsed: bigint): string;
10
+ export declare function logHeader(title: string): void;
11
+ export declare function logSection(title: string): void;
12
+ export declare function logDivider(): void;
13
+ export declare function logFooter(message?: string): void;
14
+ export declare function logPosition(position: PositionInfo | null, protocol: string): void;
15
+ export declare function logLeverageParams(params: {
16
+ protocol: string;
17
+ depositAsset: string;
18
+ depositAmount: string;
19
+ multiplier: number;
20
+ }): void;
21
+ export declare function logLeveragePreview(preview: LeveragePreview): void;
22
+ export declare function logStrategyResult(result: StrategyResult, strategyName: string, isDryRun?: boolean): void;
23
+ export declare function logWallet(address: string): void;
24
+ export declare function logBalances(balances: Array<{
25
+ symbol: string;
26
+ balance: string;
27
+ decimals?: number;
28
+ }>): void;
29
+ export declare function logSDKInit(success?: boolean): void;
30
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ5E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,QAAQ,EAAE,MAAM,GACf,MAAM,CAGR;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAMD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI7C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAG9C;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE,MAAkB,GAAG,IAAI,CAI3D;AAMD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,YAAY,GAAG,IAAI,EAC7B,QAAQ,EAAE,MAAM,GACf,IAAI,CAsBN;AAMD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAOP;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAcjE;AAMD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,OAAc,GACvB,IAAI,CAuBN;AAMD,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACtE,IAAI,CAON;AAMD,wBAAgB,UAAU,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI,CAKxD"}