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