@t2000/sdk 0.1.3 → 0.1.5
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 +10 -5
- package/dist/index.cjs +255 -331
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +255 -331
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,13 +147,18 @@ validateAddress('0x...'); // throws if invalid
|
|
|
147
147
|
|
|
148
148
|
## Gas Abstraction
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
Every operation (send, save, borrow, repay, withdraw, swap) routes through a 3-step gas resolution chain via `executeWithGas()`. The agent never fails due to low gas if it has USDC or the Gas Station is reachable:
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
| Step | Strategy | Condition | How it works |
|
|
153
|
+
|------|----------|-----------|--------------|
|
|
154
|
+
| 1 | **Self-funded** | SUI ≥ 0.05 | Uses the agent's own SUI for gas |
|
|
155
|
+
| 2 | **Auto-topup** | SUI < 0.05, USDC ≥ $2 | Swaps $1 USDC → SUI (swap is gas-sponsored), then self-funds |
|
|
156
|
+
| 3 | **Sponsored** | Steps 1 & 2 fail | Gas Station sponsors the full transaction |
|
|
157
|
+
| 4 | **Error** | All fail | Throws `INSUFFICIENT_GAS` |
|
|
155
158
|
|
|
156
|
-
Every transaction result includes a `gasMethod` field indicating which strategy was used.
|
|
159
|
+
Every transaction result includes a `gasMethod` field (`'self-funded'` | `'auto-topup'` | `'sponsored'`) indicating which strategy was used.
|
|
160
|
+
|
|
161
|
+
**Architecture:** Each protocol operation (NAVI, Cetus, send) exposes a `buildXxxTx()` function that returns a `Transaction` without executing it. `executeWithGas()` then handles execution with the fallback chain. This separation ensures gas management is consistent across all operations.
|
|
157
162
|
|
|
158
163
|
## Configuration
|
|
159
164
|
|