moltspay 0.2.10 → 0.3.0
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/cli.js +7 -3
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +7 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +132 -1
- package/dist/index.d.ts +132 -1
- package/dist/index.js +185 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/cli.js
CHANGED
|
@@ -1339,6 +1339,10 @@ init_chains();
|
|
|
1339
1339
|
// src/index.ts
|
|
1340
1340
|
init_chains();
|
|
1341
1341
|
|
|
1342
|
+
// src/x402/index.ts
|
|
1343
|
+
var import_ethers10 = require("ethers");
|
|
1344
|
+
init_chains();
|
|
1345
|
+
|
|
1342
1346
|
// src/cli.ts
|
|
1343
1347
|
var program = new import_commander.Command();
|
|
1344
1348
|
program.name("payment-agent").description("Blockchain payment infrastructure for AI Agents").version("0.1.0");
|
|
@@ -1456,7 +1460,7 @@ program.command("auth-request").description("Generate authorization request for
|
|
|
1456
1460
|
}
|
|
1457
1461
|
});
|
|
1458
1462
|
program.command("sign-permit").description("Sign a permit (Owner uses this to authorize Agent)").requiredOption("-o, --owner <address>", "Owner address").requiredOption("-s, --spender <address>", "Spender address (Agent)").requiredOption("-a, --amount <amount>", "Amount in USDC").requiredOption("-d, --deadline <timestamp>", "Deadline timestamp").requiredOption("-n, --nonce <nonce>", "Nonce from contract").option("-c, --chain <chain>", "Chain name", "base").option("-k, --private-key <key>", "Private key (or set OWNER_PRIVATE_KEY env)").action(async (options) => {
|
|
1459
|
-
const { ethers:
|
|
1463
|
+
const { ethers: ethers11 } = await import("ethers");
|
|
1460
1464
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_chains(), chains_exports));
|
|
1461
1465
|
const privateKey = options.privateKey || process.env.OWNER_PRIVATE_KEY;
|
|
1462
1466
|
if (!privateKey) {
|
|
@@ -1464,7 +1468,7 @@ program.command("sign-permit").description("Sign a permit (Owner uses this to au
|
|
|
1464
1468
|
process.exit(1);
|
|
1465
1469
|
}
|
|
1466
1470
|
const chainConfig = getChain2(options.chain);
|
|
1467
|
-
const wallet = new
|
|
1471
|
+
const wallet = new ethers11.Wallet(privateKey);
|
|
1468
1472
|
if (wallet.address.toLowerCase() !== options.owner.toLowerCase()) {
|
|
1469
1473
|
console.error(`Error: Private key doesn't match owner address`);
|
|
1470
1474
|
console.error(` Expected: ${options.owner}`);
|
|
@@ -1495,7 +1499,7 @@ program.command("sign-permit").description("Sign a permit (Owner uses this to au
|
|
|
1495
1499
|
deadline: parseInt(options.deadline)
|
|
1496
1500
|
};
|
|
1497
1501
|
const signature = await wallet.signTypedData(domain, types, message);
|
|
1498
|
-
const sig =
|
|
1502
|
+
const sig = ethers11.Signature.from(signature);
|
|
1499
1503
|
const permit = {
|
|
1500
1504
|
owner: options.owner,
|
|
1501
1505
|
value,
|