@t2000/sdk 0.18.22 → 0.18.24

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 CHANGED
@@ -56162,14 +56162,19 @@ async function trySponsored(client, keypair, tx) {
56162
56162
  };
56163
56163
  }
56164
56164
  async function waitForIndexer(client, digest) {
56165
+ const start = Date.now();
56165
56166
  for (let i = 0; i < 3; i++) {
56166
56167
  try {
56167
56168
  await client.getTransactionBlock({ digest, options: { showObjectChanges: true } });
56168
- return;
56169
+ break;
56169
56170
  } catch {
56170
- await new Promise((r) => setTimeout(r, 1e3));
56171
+ await new Promise((r) => setTimeout(r, 500));
56171
56172
  }
56172
56173
  }
56174
+ const elapsed = Date.now() - start;
56175
+ if (elapsed < 2e3) {
56176
+ await new Promise((r) => setTimeout(r, 2e3 - elapsed));
56177
+ }
56173
56178
  }
56174
56179
  async function executeWithGas(client, keypair, buildTx, options) {
56175
56180
  if (options?.enforcer && options?.metadata) {
@@ -56201,6 +56206,20 @@ async function executeWithGas(client, keypair, buildTx, options) {
56201
56206
  } catch (err) {
56202
56207
  errors.push(`auto-topup: ${err instanceof Error ? err.message : String(err)}`);
56203
56208
  }
56209
+ try {
56210
+ const tx = await buildTx();
56211
+ const result = await trySelfFunded(client, keypair, tx);
56212
+ if (result) {
56213
+ await waitForIndexer(client, result.digest);
56214
+ return result;
56215
+ }
56216
+ } catch (err) {
56217
+ const msg = err instanceof Error ? err.message : String(err);
56218
+ if (isMoveAbort(msg)) {
56219
+ throw new T2000Error("TRANSACTION_FAILED", parseMoveAbortMessage(msg));
56220
+ }
56221
+ errors.push(`self-funded-retry: ${msg}`);
56222
+ }
56204
56223
  try {
56205
56224
  const tx = await buildTx();
56206
56225
  const result = await trySponsored(client, keypair, tx);