@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
package/dist/index.cjs
CHANGED
|
@@ -678,7 +678,15 @@ async function fetchAllCoins(client, owner, coinType) {
|
|
|
678
678
|
}
|
|
679
679
|
async function selectAndSplitCoin(tx, client, owner, coinType, amount, options = {}) {
|
|
680
680
|
if (options.sponsoredContext) {
|
|
681
|
-
return selectCoinObjectsOnly(
|
|
681
|
+
return selectCoinObjectsOnly(
|
|
682
|
+
tx,
|
|
683
|
+
client,
|
|
684
|
+
owner,
|
|
685
|
+
coinType,
|
|
686
|
+
amount,
|
|
687
|
+
options.allowSwapAll ?? true,
|
|
688
|
+
options.mergeCache
|
|
689
|
+
);
|
|
682
690
|
}
|
|
683
691
|
const balanceResp = await client.getBalance({ owner, coinType });
|
|
684
692
|
const totalBalance = BigInt(balanceResp.totalBalance);
|
|
@@ -985,14 +993,15 @@ async function addSwapToTx(tx, client, address, input) {
|
|
|
985
993
|
address,
|
|
986
994
|
requestedRaw,
|
|
987
995
|
input.sponsoredContext ?? false,
|
|
988
|
-
input.
|
|
996
|
+
input.coinMergeCache
|
|
989
997
|
);
|
|
990
998
|
inputCoin = result.coin;
|
|
991
999
|
effectiveRaw = result.effectiveAmount;
|
|
992
1000
|
} else {
|
|
993
1001
|
const { selectAndSplitCoin: selectAndSplitCoin2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
|
|
994
1002
|
const result = await selectAndSplitCoin2(tx, client, address, fromType, requestedRaw, {
|
|
995
|
-
sponsoredContext: input.sponsoredContext ?? false
|
|
1003
|
+
sponsoredContext: input.sponsoredContext ?? false,
|
|
1004
|
+
mergeCache: input.coinMergeCache
|
|
996
1005
|
});
|
|
997
1006
|
inputCoin = result.coin;
|
|
998
1007
|
effectiveRaw = result.effectiveAmount;
|
|
@@ -7973,7 +7982,8 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
7973
7982
|
effectiveAmount = rawAmount;
|
|
7974
7983
|
} else {
|
|
7975
7984
|
const r = await selectAndSplitCoin(tx, ctx.client, ctx.sender, assetInfo.type, rawAmount, {
|
|
7976
|
-
sponsoredContext: ctx.sponsoredContext
|
|
7985
|
+
sponsoredContext: ctx.sponsoredContext,
|
|
7986
|
+
mergeCache: ctx.coinMergeCache
|
|
7977
7987
|
});
|
|
7978
7988
|
coin = r.coin;
|
|
7979
7989
|
effectiveAmount = r.effectiveAmount;
|
|
@@ -8047,7 +8057,8 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
8047
8057
|
effectiveAmount = rawAmount;
|
|
8048
8058
|
} else {
|
|
8049
8059
|
const r = await selectAndSplitCoin(tx, ctx.client, ctx.sender, assetInfo.type, rawAmount, {
|
|
8050
|
-
sponsoredContext: ctx.sponsoredContext
|
|
8060
|
+
sponsoredContext: ctx.sponsoredContext,
|
|
8061
|
+
mergeCache: ctx.coinMergeCache
|
|
8051
8062
|
});
|
|
8052
8063
|
coin = r.coin;
|
|
8053
8064
|
effectiveAmount = r.effectiveAmount;
|
|
@@ -8091,7 +8102,14 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
8091
8102
|
};
|
|
8092
8103
|
}
|
|
8093
8104
|
if (asset === "SUI") {
|
|
8094
|
-
const result = await selectSuiCoin(
|
|
8105
|
+
const result = await selectSuiCoin(
|
|
8106
|
+
tx,
|
|
8107
|
+
ctx.client,
|
|
8108
|
+
ctx.sender,
|
|
8109
|
+
rawAmount,
|
|
8110
|
+
ctx.sponsoredContext,
|
|
8111
|
+
ctx.coinMergeCache
|
|
8112
|
+
);
|
|
8095
8113
|
addSendToTx(tx, result.coin, recipient);
|
|
8096
8114
|
return {
|
|
8097
8115
|
preview: {
|
|
@@ -8154,7 +8172,7 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
8154
8172
|
inputCoin: ctx.chainedCoin,
|
|
8155
8173
|
precomputedRoute: input.precomputedRoute,
|
|
8156
8174
|
sponsoredContext: ctx.sponsoredContext,
|
|
8157
|
-
|
|
8175
|
+
coinMergeCache: ctx.coinMergeCache
|
|
8158
8176
|
});
|
|
8159
8177
|
if (!ctx.isOutputConsumed) {
|
|
8160
8178
|
tx.transferObjects([result.coin], ctx.sender);
|
|
@@ -8258,10 +8276,10 @@ async function composeTx(opts) {
|
|
|
8258
8276
|
sponsoredContext: opts.sponsoredContext ?? false,
|
|
8259
8277
|
overlayFee: opts.overlayFee,
|
|
8260
8278
|
feeHooks: opts.feeHooks,
|
|
8261
|
-
// One cache per compose run — shared across all legs
|
|
8262
|
-
// sponsored bundles that source the same coin (
|
|
8263
|
-
// merge that coin's objects
|
|
8264
|
-
|
|
8279
|
+
// One cache per compose run — shared across all legs (any coin type)
|
|
8280
|
+
// so multi-leg sponsored bundles that source the same coin (two SUI
|
|
8281
|
+
// swaps, swap USDC + save USDC, ...) merge that coin's objects once.
|
|
8282
|
+
coinMergeCache: /* @__PURE__ */ new Map()
|
|
8265
8283
|
};
|
|
8266
8284
|
const consumedSteps = /* @__PURE__ */ new Set();
|
|
8267
8285
|
for (let i = 0; i < opts.steps.length; i++) {
|