@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.
@@ -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-DUmk5ivZ.cjs';
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-DUmk5ivZ.js';
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`) called
118
- * `selectCoinObjectsOnly` once per leg. Each call emitted its own
119
- * `mergeCoins` over the SAME coin objects, so the second leg's merge
120
- * referenced coins the first leg already consumed → Enoki dry-run failed
121
- * with `CommandArgumentError { ArgumentWithoutValue }`. Non-SUI legs dodge
122
- * this because they go through `coinWithBalance`, whose resolver batches
123
- * all intents for one coin type into a single build-time merge. The SUI
124
- * sponsored path has no such batching, so the cache supplies it.
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 SUI sourcing. Provided by
399
- * `composeTx`'s orchestration loop so multiple SUI-source legs in one
400
- * bundle share a single merged primary coin instead of each emitting
401
- * its own `mergeCoins` (the second of which references already-consumed
402
- * coins Enoki dry-run `ArgumentWithoutValue`). Single swaps / non-SUI
403
- * sources don't need it; omit. See `SponsoredCoinMergeCache` JSDoc.
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
- suiMergeCache?: SponsoredCoinMergeCache;
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`) called
118
- * `selectCoinObjectsOnly` once per leg. Each call emitted its own
119
- * `mergeCoins` over the SAME coin objects, so the second leg's merge
120
- * referenced coins the first leg already consumed → Enoki dry-run failed
121
- * with `CommandArgumentError { ArgumentWithoutValue }`. Non-SUI legs dodge
122
- * this because they go through `coinWithBalance`, whose resolver batches
123
- * all intents for one coin type into a single build-time merge. The SUI
124
- * sponsored path has no such batching, so the cache supplies it.
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 SUI sourcing. Provided by
399
- * `composeTx`'s orchestration loop so multiple SUI-source legs in one
400
- * bundle share a single merged primary coin instead of each emitting
401
- * its own `mergeCoins` (the second of which references already-consumed
402
- * coins Enoki dry-run `ArgumentWithoutValue`). Single swaps / non-SUI
403
- * sources don't need it; omit. See `SponsoredCoinMergeCache` JSDoc.
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
- suiMergeCache?: SponsoredCoinMergeCache;
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.1",
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",