@t2000/sdk 0.18.20 → 0.18.22
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/index.cjs +22 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -56161,6 +56161,16 @@ async function trySponsored(client, keypair, tx) {
|
|
|
56161
56161
|
gasCostSui: gasCost
|
|
56162
56162
|
};
|
|
56163
56163
|
}
|
|
56164
|
+
async function waitForIndexer(client, digest) {
|
|
56165
|
+
for (let i = 0; i < 3; i++) {
|
|
56166
|
+
try {
|
|
56167
|
+
await client.getTransactionBlock({ digest, options: { showObjectChanges: true } });
|
|
56168
|
+
return;
|
|
56169
|
+
} catch {
|
|
56170
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
56171
|
+
}
|
|
56172
|
+
}
|
|
56173
|
+
}
|
|
56164
56174
|
async function executeWithGas(client, keypair, buildTx, options) {
|
|
56165
56175
|
if (options?.enforcer && options?.metadata) {
|
|
56166
56176
|
options.enforcer.check(options.metadata);
|
|
@@ -56169,7 +56179,10 @@ async function executeWithGas(client, keypair, buildTx, options) {
|
|
|
56169
56179
|
try {
|
|
56170
56180
|
const tx = await buildTx();
|
|
56171
56181
|
const result = await trySelfFunded(client, keypair, tx);
|
|
56172
|
-
if (result)
|
|
56182
|
+
if (result) {
|
|
56183
|
+
await waitForIndexer(client, result.digest);
|
|
56184
|
+
return result;
|
|
56185
|
+
}
|
|
56173
56186
|
errors.push("self-funded: SUI below threshold");
|
|
56174
56187
|
} catch (err) {
|
|
56175
56188
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -56180,7 +56193,10 @@ async function executeWithGas(client, keypair, buildTx, options) {
|
|
|
56180
56193
|
}
|
|
56181
56194
|
try {
|
|
56182
56195
|
const result = await tryAutoTopUpThenSelfFund(client, keypair, buildTx);
|
|
56183
|
-
if (result)
|
|
56196
|
+
if (result) {
|
|
56197
|
+
await waitForIndexer(client, result.digest);
|
|
56198
|
+
return result;
|
|
56199
|
+
}
|
|
56184
56200
|
errors.push("auto-topup: not eligible (low USDC or sufficient SUI)");
|
|
56185
56201
|
} catch (err) {
|
|
56186
56202
|
errors.push(`auto-topup: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -56188,7 +56204,10 @@ async function executeWithGas(client, keypair, buildTx, options) {
|
|
|
56188
56204
|
try {
|
|
56189
56205
|
const tx = await buildTx();
|
|
56190
56206
|
const result = await trySponsored(client, keypair, tx);
|
|
56191
|
-
if (result)
|
|
56207
|
+
if (result) {
|
|
56208
|
+
await waitForIndexer(client, result.digest);
|
|
56209
|
+
return result;
|
|
56210
|
+
}
|
|
56192
56211
|
errors.push("sponsored: returned null");
|
|
56193
56212
|
} catch (err) {
|
|
56194
56213
|
errors.push(`sponsored: ${err instanceof Error ? err.message : String(err)}`);
|