@t2000/sdk 2.13.2 → 2.14.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/dist/adapters/index.cjs +12 -29
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +13 -30
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +135 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -80
- package/dist/index.d.ts +74 -80
- package/dist/index.js +136 -235
- package/dist/index.js.map +1 -1
- package/dist/{types-BY6ovQGK.d.cts → types-1WUNZK-9.d.cts} +1 -1
- package/dist/{types-epj9U13o.d.cts → types-CFJrgLm2.d.cts} +21 -13
- package/dist/{types-epj9U13o.d.ts → types-CFJrgLm2.d.ts} +21 -13
- package/dist/{types-WeZQDV54.d.ts → types-D65N3sBO.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-
|
|
3
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-CFJrgLm2.cjs';
|
|
4
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -167,11 +167,11 @@ declare function buildSwapTx(params: {
|
|
|
167
167
|
* Append a swap fragment to an existing PTB. SPEC 7 § "Layer 1" Cetus
|
|
168
168
|
* appender. Two modes, dispatched by the presence of `input.inputCoin`:
|
|
169
169
|
*
|
|
170
|
-
* - **Wallet mode** (`inputCoin` omitted) —
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* `transactions/prepare/route.ts` swap branch (P2.2c will
|
|
174
|
-
* branch in favor of this appender via `composeTx`).
|
|
170
|
+
* - **Wallet mode** (`inputCoin` omitted) — sources `from`-asset funds
|
|
171
|
+
* via `coinWithBalance({ type, balance })` (resolves coin objects +
|
|
172
|
+
* address balance at build time), runs the swap. Mirrors the audric
|
|
173
|
+
* host's `transactions/prepare/route.ts` swap branch (P2.2c will
|
|
174
|
+
* retire that branch in favor of this appender via `composeTx`).
|
|
175
175
|
*
|
|
176
176
|
* - **Chain mode** (`inputCoin` provided) — consumes the passed-in coin
|
|
177
177
|
* reference (typically produced by an upstream appender like
|
|
@@ -179,14 +179,14 @@ declare function buildSwapTx(params: {
|
|
|
179
179
|
* split. This is the SPEC 7 multi-write enabler ("withdraw → swap →
|
|
180
180
|
* save" without intermediate wallet materialization).
|
|
181
181
|
*
|
|
182
|
-
* **SUI in wallet mode:**
|
|
183
|
-
* token
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* the caller should pre-build the
|
|
187
|
-
* `tx.splitCoins(tx.gas, [rawAmount])[0]` and pass it via
|
|
188
|
-
* instead. (`T2000.swap()` already handles this internally —
|
|
189
|
-
* users go through the high-level class, not
|
|
182
|
+
* **SUI in wallet mode:** routes through `selectAndSplitCoin` like every
|
|
183
|
+
* other token, which uses `coinWithBalance` to pull from the user's SUI
|
|
184
|
+
* (coin objects + address balance) — NOT from `tx.gas`. This is correct
|
|
185
|
+
* for sponsored flows (Enoki owns `tx.gas`). For non-sponsored flows
|
|
186
|
+
* where `tx.gas` IS the user's SUI, the caller should pre-build the
|
|
187
|
+
* inputCoin via `tx.splitCoins(tx.gas, [rawAmount])[0]` and pass it via
|
|
188
|
+
* chain mode instead. (`T2000.swap()` already handles this internally —
|
|
189
|
+
* direct SDK users go through the high-level class, not this appender.)
|
|
190
190
|
*
|
|
191
191
|
* **`swapAll` semantics (wallet mode):** if the requested raw amount
|
|
192
192
|
* is >= the wallet's total `from` balance, the appender consumes the
|
|
@@ -526,6 +526,14 @@ interface PayResult {
|
|
|
526
526
|
body: unknown;
|
|
527
527
|
paid: boolean;
|
|
528
528
|
cost?: number;
|
|
529
|
+
/**
|
|
530
|
+
* SUI gas cost actually paid on chain. Zero for gasless payments —
|
|
531
|
+
* which means an MPP payment hit the protocol's gasless allowlist
|
|
532
|
+
* (USDC / USDsui / USDY / FdUSD / AUSD / BUCK / USDB / SUI_USDE) and
|
|
533
|
+
* was accepted with `gasPrice=0, gasBudget=0, gasPayment=[]`. See
|
|
534
|
+
* https://docs.sui.io/develop/transaction-payment/gasless-stablecoin-transfers
|
|
535
|
+
*/
|
|
536
|
+
gasCostSui?: number;
|
|
529
537
|
receipt?: {
|
|
530
538
|
reference: string;
|
|
531
539
|
timestamp: string;
|
|
@@ -167,11 +167,11 @@ declare function buildSwapTx(params: {
|
|
|
167
167
|
* Append a swap fragment to an existing PTB. SPEC 7 § "Layer 1" Cetus
|
|
168
168
|
* appender. Two modes, dispatched by the presence of `input.inputCoin`:
|
|
169
169
|
*
|
|
170
|
-
* - **Wallet mode** (`inputCoin` omitted) —
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* `transactions/prepare/route.ts` swap branch (P2.2c will
|
|
174
|
-
* branch in favor of this appender via `composeTx`).
|
|
170
|
+
* - **Wallet mode** (`inputCoin` omitted) — sources `from`-asset funds
|
|
171
|
+
* via `coinWithBalance({ type, balance })` (resolves coin objects +
|
|
172
|
+
* address balance at build time), runs the swap. Mirrors the audric
|
|
173
|
+
* host's `transactions/prepare/route.ts` swap branch (P2.2c will
|
|
174
|
+
* retire that branch in favor of this appender via `composeTx`).
|
|
175
175
|
*
|
|
176
176
|
* - **Chain mode** (`inputCoin` provided) — consumes the passed-in coin
|
|
177
177
|
* reference (typically produced by an upstream appender like
|
|
@@ -179,14 +179,14 @@ declare function buildSwapTx(params: {
|
|
|
179
179
|
* split. This is the SPEC 7 multi-write enabler ("withdraw → swap →
|
|
180
180
|
* save" without intermediate wallet materialization).
|
|
181
181
|
*
|
|
182
|
-
* **SUI in wallet mode:**
|
|
183
|
-
* token
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* the caller should pre-build the
|
|
187
|
-
* `tx.splitCoins(tx.gas, [rawAmount])[0]` and pass it via
|
|
188
|
-
* instead. (`T2000.swap()` already handles this internally —
|
|
189
|
-
* users go through the high-level class, not
|
|
182
|
+
* **SUI in wallet mode:** routes through `selectAndSplitCoin` like every
|
|
183
|
+
* other token, which uses `coinWithBalance` to pull from the user's SUI
|
|
184
|
+
* (coin objects + address balance) — NOT from `tx.gas`. This is correct
|
|
185
|
+
* for sponsored flows (Enoki owns `tx.gas`). For non-sponsored flows
|
|
186
|
+
* where `tx.gas` IS the user's SUI, the caller should pre-build the
|
|
187
|
+
* inputCoin via `tx.splitCoins(tx.gas, [rawAmount])[0]` and pass it via
|
|
188
|
+
* chain mode instead. (`T2000.swap()` already handles this internally —
|
|
189
|
+
* direct SDK users go through the high-level class, not this appender.)
|
|
190
190
|
*
|
|
191
191
|
* **`swapAll` semantics (wallet mode):** if the requested raw amount
|
|
192
192
|
* is >= the wallet's total `from` balance, the appender consumes the
|
|
@@ -526,6 +526,14 @@ interface PayResult {
|
|
|
526
526
|
body: unknown;
|
|
527
527
|
paid: boolean;
|
|
528
528
|
cost?: number;
|
|
529
|
+
/**
|
|
530
|
+
* SUI gas cost actually paid on chain. Zero for gasless payments —
|
|
531
|
+
* which means an MPP payment hit the protocol's gasless allowlist
|
|
532
|
+
* (USDC / USDsui / USDY / FdUSD / AUSD / BUCK / USDB / SUI_USDE) and
|
|
533
|
+
* was accepted with `gasPrice=0, gasBudget=0, gasPayment=[]`. See
|
|
534
|
+
* https://docs.sui.io/develop/transaction-payment/gasless-stablecoin-transfers
|
|
535
|
+
*/
|
|
536
|
+
gasCostSui?: number;
|
|
529
537
|
receipt?: {
|
|
530
538
|
reference: string;
|
|
531
539
|
timestamp: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-
|
|
3
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-CFJrgLm2.js';
|
|
4
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
5
|
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "TypeScript SDK for AI agent bank accounts on Sui — send, save, borrow, swap. NAVI lending + Cetus aggregator routing, sponsored gas, zkLogin compatible.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|