moltspay 0.9.6 → 0.9.7
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/README.md +68 -45
- package/dist/cli/index.js +23 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +23 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/index.js +11 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +11 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -270,7 +270,17 @@ var MoltsPayClient = class {
|
|
|
270
270
|
throw new Error(`Insufficient balance: need $${amount}, have ${balances.usdc} USDC / ${balances.usdt} USDT`);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
if (token === "USDT") {
|
|
274
|
+
const balances = await this.getBalance();
|
|
275
|
+
if (balances.native < 1e-4) {
|
|
276
|
+
throw new Error(
|
|
277
|
+
`USDT requires ETH for gas (~$0.01 on Base). Your ETH balance: ${balances.native.toFixed(6)} ETH. Please add a small amount of ETH to your wallet, or use USDC (gasless).`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
console.log(`[MoltsPay] \u26A0\uFE0F USDT requires gas (~$0.01). Proceeding with payment...`);
|
|
281
|
+
} else {
|
|
282
|
+
console.log(`[MoltsPay] Signing payment: $${amount} ${token} (gasless)`);
|
|
283
|
+
}
|
|
274
284
|
const payTo = req.payTo || req.resource;
|
|
275
285
|
if (!payTo) {
|
|
276
286
|
throw new Error("Missing payTo address in payment requirements");
|
|
@@ -2013,6 +2023,18 @@ program.command("pay <server> <service> [params]").description("Pay for a servic
|
|
|
2013
2023
|
}
|
|
2014
2024
|
const imageDisplay = params.image_url || (params.image_base64 ? `[local file: ${options.image}]` : null);
|
|
2015
2025
|
const token = (options.token || "USDC").toUpperCase();
|
|
2026
|
+
if (token === "USDT") {
|
|
2027
|
+
const balance = await client.getBalance();
|
|
2028
|
+
if (balance.native < 1e-4) {
|
|
2029
|
+
console.log("\n\u26A0\uFE0F USDT requires a small amount of ETH for gas (~$0.01)");
|
|
2030
|
+
console.log(` Your ETH balance: ${balance.native.toFixed(6)} ETH`);
|
|
2031
|
+
console.log(" Please add a tiny amount of ETH to your wallet.\n");
|
|
2032
|
+
process.exit(1);
|
|
2033
|
+
}
|
|
2034
|
+
if (!options.json) {
|
|
2035
|
+
console.log("\n\u26A0\uFE0F Note: USDT payments require gas (~$0.01 on Base)");
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2016
2038
|
if (!options.json) {
|
|
2017
2039
|
console.log(`
|
|
2018
2040
|
\u{1F4B3} MoltsPay - Paying for service
|