@t2000/sdk 0.1.5 → 0.1.6
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 +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -943,28 +943,35 @@ async function trySponsored(client, keypair, tx) {
|
|
|
943
943
|
};
|
|
944
944
|
}
|
|
945
945
|
async function executeWithGas(client, keypair, buildTx) {
|
|
946
|
+
const errors = [];
|
|
946
947
|
try {
|
|
947
948
|
const tx = await buildTx();
|
|
948
949
|
const result = await trySelfFunded(client, keypair, tx);
|
|
949
950
|
if (result) return result;
|
|
950
|
-
|
|
951
|
+
errors.push("self-funded: SUI below threshold");
|
|
952
|
+
} catch (err) {
|
|
953
|
+
errors.push(`self-funded: ${err instanceof Error ? err.message : String(err)}`);
|
|
951
954
|
}
|
|
952
955
|
try {
|
|
953
956
|
const tx = await buildTx();
|
|
954
957
|
const result = await tryAutoTopUpThenSelfFund(client, keypair, tx);
|
|
955
958
|
if (result) return result;
|
|
956
|
-
|
|
959
|
+
errors.push("auto-topup: not eligible (low USDC or sufficient SUI)");
|
|
960
|
+
} catch (err) {
|
|
961
|
+
errors.push(`auto-topup: ${err instanceof Error ? err.message : String(err)}`);
|
|
957
962
|
}
|
|
958
963
|
try {
|
|
959
964
|
const tx = await buildTx();
|
|
960
965
|
const result = await trySponsored(client, keypair, tx);
|
|
961
966
|
if (result) return result;
|
|
962
|
-
|
|
967
|
+
errors.push("sponsored: returned null");
|
|
968
|
+
} catch (err) {
|
|
969
|
+
errors.push(`sponsored: ${err instanceof Error ? err.message : String(err)}`);
|
|
963
970
|
}
|
|
964
971
|
throw new T2000Error(
|
|
965
972
|
"INSUFFICIENT_GAS",
|
|
966
|
-
|
|
967
|
-
{ reason: "all_gas_methods_exhausted" }
|
|
973
|
+
`No SUI for gas and Gas Station unavailable. Fund your wallet with SUI or USDC. [${errors.join(" | ")}]`,
|
|
974
|
+
{ reason: "all_gas_methods_exhausted", errors }
|
|
968
975
|
);
|
|
969
976
|
}
|
|
970
977
|
|