@t2000/sdk 4.2.1 → 4.2.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/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +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 +29 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +29 -11
- package/dist/index.js.map +1 -1
- package/dist/{types-8CNP74n6.d.cts → types-BjvEpkwT.d.cts} +1 -1
- package/dist/{types-BTbqE8AE.d.ts → types-CElCPOFA.d.ts} +1 -1
- package/dist/{types-DUmk5ivZ.d.cts → types-Ch0zVUpC.d.cts} +24 -15
- package/dist/{types-DUmk5ivZ.d.ts → types-Ch0zVUpC.d.ts} +24 -15
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-
|
|
4
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.cjs';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-
|
|
4
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.js';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -92,6 +92,7 @@ interface SelectAndSplitResult {
|
|
|
92
92
|
declare function selectAndSplitCoin(tx: Transaction, client: SuiJsonRpcClient, owner: string, coinType: string, amount: bigint | 'all', options?: {
|
|
93
93
|
allowSwapAll?: boolean;
|
|
94
94
|
sponsoredContext?: boolean;
|
|
95
|
+
mergeCache?: SponsoredCoinMergeCache;
|
|
95
96
|
}): Promise<SelectAndSplitResult>;
|
|
96
97
|
/**
|
|
97
98
|
* Coin-object-only selection for sponsored (Enoki) transactions. Fetches the
|
|
@@ -114,14 +115,20 @@ declare function selectAndSplitCoin(tx: Transaction, client: SuiJsonRpcClient, o
|
|
|
114
115
|
* `primary` instead of re-fetching + re-merging.
|
|
115
116
|
*
|
|
116
117
|
* Why this exists (S.xxx, 2026-06-02): a sponsored bundle with 2+ legs
|
|
117
|
-
* sourcing the same coin (e.g. `SUI→WAL` + `SUI→DEEP`
|
|
118
|
-
* `selectCoinObjectsOnly` once per leg. Each call
|
|
119
|
-
* `mergeCoins` over the SAME coin objects, so the second
|
|
120
|
-
* referenced coins the first leg already consumed → Enoki
|
|
121
|
-
* with `CommandArgumentError { ArgumentWithoutValue }`.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
118
|
+
* sourcing the same coin (e.g. `SUI→WAL` + `SUI→DEEP`, or `swap USDC` +
|
|
119
|
+
* `save USDC`) called `selectCoinObjectsOnly` once per leg. Each call
|
|
120
|
+
* emitted its own `mergeCoins` over the SAME coin objects, so the second
|
|
121
|
+
* leg's merge referenced coins the first leg already consumed → Enoki
|
|
122
|
+
* dry-run failed with `CommandArgumentError { ArgumentWithoutValue }`.
|
|
123
|
+
*
|
|
124
|
+
* This is NOT SUI-specific. Under sponsorship, `selectAndSplitCoin` routes
|
|
125
|
+
* EVERY asset through `selectCoinObjectsOnly` (the `coinWithBalance`
|
|
126
|
+
* batching that would otherwise dedup these merges only runs for
|
|
127
|
+
* non-sponsored CLI/direct flows — its address-balance `FundsWithdrawal`
|
|
128
|
+
* reservation is what Enoki can't deserialize, issue #93). So the cache is
|
|
129
|
+
* the dedup layer for ALL coin types in a sponsored multi-leg PTB, keyed
|
|
130
|
+
* by coin type. SUI was simply the first asset observed failing in the
|
|
131
|
+
* wild because it's the most common swap source.
|
|
125
132
|
*/
|
|
126
133
|
type SponsoredCoinMergeCache = Map<string, {
|
|
127
134
|
primary: TransactionObjectArgument;
|
|
@@ -395,14 +402,16 @@ declare function addSwapToTx(tx: Transaction, client: SuiJsonRpcClient, address:
|
|
|
395
402
|
*/
|
|
396
403
|
sponsoredContext?: boolean;
|
|
397
404
|
/**
|
|
398
|
-
* Per-PTB merge cache for sponsored
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
405
|
+
* Per-PTB merge cache for sponsored coin-object sourcing (any coin
|
|
406
|
+
* type — SUI in the dedicated branch, USDC/USDsui/etc. in the wallet
|
|
407
|
+
* branch). Provided by `composeTx`'s orchestration loop so multiple
|
|
408
|
+
* legs sourcing the same coin in one bundle share a single merged
|
|
409
|
+
* primary coin instead of each emitting its own `mergeCoins` (the
|
|
410
|
+
* second of which references already-consumed coins → Enoki dry-run
|
|
411
|
+
* `ArgumentWithoutValue`). Single swaps don't need it; omit. See
|
|
412
|
+
* `SponsoredCoinMergeCache` JSDoc.
|
|
404
413
|
*/
|
|
405
|
-
|
|
414
|
+
coinMergeCache?: SponsoredCoinMergeCache;
|
|
406
415
|
}): Promise<{
|
|
407
416
|
coin: TransactionObjectArgument;
|
|
408
417
|
effectiveAmountIn: number;
|
|
@@ -92,6 +92,7 @@ interface SelectAndSplitResult {
|
|
|
92
92
|
declare function selectAndSplitCoin(tx: Transaction, client: SuiJsonRpcClient, owner: string, coinType: string, amount: bigint | 'all', options?: {
|
|
93
93
|
allowSwapAll?: boolean;
|
|
94
94
|
sponsoredContext?: boolean;
|
|
95
|
+
mergeCache?: SponsoredCoinMergeCache;
|
|
95
96
|
}): Promise<SelectAndSplitResult>;
|
|
96
97
|
/**
|
|
97
98
|
* Coin-object-only selection for sponsored (Enoki) transactions. Fetches the
|
|
@@ -114,14 +115,20 @@ declare function selectAndSplitCoin(tx: Transaction, client: SuiJsonRpcClient, o
|
|
|
114
115
|
* `primary` instead of re-fetching + re-merging.
|
|
115
116
|
*
|
|
116
117
|
* Why this exists (S.xxx, 2026-06-02): a sponsored bundle with 2+ legs
|
|
117
|
-
* sourcing the same coin (e.g. `SUI→WAL` + `SUI→DEEP`
|
|
118
|
-
* `selectCoinObjectsOnly` once per leg. Each call
|
|
119
|
-
* `mergeCoins` over the SAME coin objects, so the second
|
|
120
|
-
* referenced coins the first leg already consumed → Enoki
|
|
121
|
-
* with `CommandArgumentError { ArgumentWithoutValue }`.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
118
|
+
* sourcing the same coin (e.g. `SUI→WAL` + `SUI→DEEP`, or `swap USDC` +
|
|
119
|
+
* `save USDC`) called `selectCoinObjectsOnly` once per leg. Each call
|
|
120
|
+
* emitted its own `mergeCoins` over the SAME coin objects, so the second
|
|
121
|
+
* leg's merge referenced coins the first leg already consumed → Enoki
|
|
122
|
+
* dry-run failed with `CommandArgumentError { ArgumentWithoutValue }`.
|
|
123
|
+
*
|
|
124
|
+
* This is NOT SUI-specific. Under sponsorship, `selectAndSplitCoin` routes
|
|
125
|
+
* EVERY asset through `selectCoinObjectsOnly` (the `coinWithBalance`
|
|
126
|
+
* batching that would otherwise dedup these merges only runs for
|
|
127
|
+
* non-sponsored CLI/direct flows — its address-balance `FundsWithdrawal`
|
|
128
|
+
* reservation is what Enoki can't deserialize, issue #93). So the cache is
|
|
129
|
+
* the dedup layer for ALL coin types in a sponsored multi-leg PTB, keyed
|
|
130
|
+
* by coin type. SUI was simply the first asset observed failing in the
|
|
131
|
+
* wild because it's the most common swap source.
|
|
125
132
|
*/
|
|
126
133
|
type SponsoredCoinMergeCache = Map<string, {
|
|
127
134
|
primary: TransactionObjectArgument;
|
|
@@ -395,14 +402,16 @@ declare function addSwapToTx(tx: Transaction, client: SuiJsonRpcClient, address:
|
|
|
395
402
|
*/
|
|
396
403
|
sponsoredContext?: boolean;
|
|
397
404
|
/**
|
|
398
|
-
* Per-PTB merge cache for sponsored
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
405
|
+
* Per-PTB merge cache for sponsored coin-object sourcing (any coin
|
|
406
|
+
* type — SUI in the dedicated branch, USDC/USDsui/etc. in the wallet
|
|
407
|
+
* branch). Provided by `composeTx`'s orchestration loop so multiple
|
|
408
|
+
* legs sourcing the same coin in one bundle share a single merged
|
|
409
|
+
* primary coin instead of each emitting its own `mergeCoins` (the
|
|
410
|
+
* second of which references already-consumed coins → Enoki dry-run
|
|
411
|
+
* `ArgumentWithoutValue`). Single swaps don't need it; omit. See
|
|
412
|
+
* `SponsoredCoinMergeCache` JSDoc.
|
|
404
413
|
*/
|
|
405
|
-
|
|
414
|
+
coinMergeCache?: SponsoredCoinMergeCache;
|
|
406
415
|
}): Promise<{
|
|
407
416
|
coin: TransactionObjectArgument;
|
|
408
417
|
effectiveAmountIn: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "TypeScript SDK for Agent Wallets on Sui — gasless USDC + USDsui transfers, Cetus swap routing, NAVI lending (programmatic), MPP paid API access, zkLogin compatible.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|