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