aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/index.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-02-20 01:16:31 +0100
committerFlorian Dold <florian@dold.me>2023-02-20 01:16:31 +0100
commit1747d3ac1853f0ec5791ded5ce4711ed3e5a343f (patch)
tree671667b377eeb9c9a82a397939072a6d1850c734 /packages/taler-wallet-cli/src/index.ts
parent30b3949d2bd9da6bceddb40f3d1921b95fa80316 (diff)
downloadwallet-core-1747d3ac1853f0ec5791ded5ce4711ed3e5a343f.tar.xz
wallet-core: rename p2p requests to something more sensible
Diffstat (limited to 'packages/taler-wallet-cli/src/index.ts')
-rw-r--r--packages/taler-wallet-cli/src/index.ts89
1 files changed, 62 insertions, 27 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index dbd5ce956..d6d780576 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -925,13 +925,32 @@ depositCli
});
});
-const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
- help: "Subcommands for advanced operations (only use if you know what you're doing!).",
+const peerCli = walletCli.subcommand("peerArgs", "p2p", {
+ help: "Subcommands for peer-to-peer payments.",
});
-advancedCli
- .subcommand("checkPayPull", "check-pay-pull", {
- help: "Check fees for a peer-pull payment initiation.",
+peerCli
+ .subcommand("checkPayPush", "check-push-debit", {
+ help: "Check fees for starting a peer-push debit transaction.",
+ })
+ .requiredArgument("amount", clk.STRING, {
+ help: "Amount to pay",
+ })
+ .action(async (args) => {
+ await withWallet(args, async (wallet) => {
+ const resp = await wallet.client.call(
+ WalletApiOperation.CheckPeerPushDebit,
+ {
+ amount: args.checkPayPush.amount,
+ },
+ );
+ console.log(JSON.stringify(resp, undefined, 2));
+ });
+ });
+
+peerCli
+ .subcommand("checkPayPull", "check-pull-credit", {
+ help: "Check fees for a starting peer-pull credit transaction.",
})
.requiredArgument("amount", clk.STRING, {
help: "Amount to request",
@@ -939,7 +958,7 @@ advancedCli
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.PreparePeerPullPayment,
+ WalletApiOperation.CheckPeerPullCredit,
{
amount: args.checkPayPull.amount,
},
@@ -948,13 +967,13 @@ advancedCli
});
});
-advancedCli
- .subcommand("prepareIncomingPayPull", "prepare-incoming-pay-pull")
+peerCli
+ .subcommand("prepareIncomingPayPull", "prepare-pull-debit")
.requiredArgument("talerUri", clk.STRING)
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.CheckPeerPullPayment,
+ WalletApiOperation.PreparePeerPullDebit,
{
talerUri: args.prepareIncomingPayPull.talerUri,
},
@@ -963,13 +982,13 @@ advancedCli
});
});
-advancedCli
- .subcommand("confirmIncomingPayPull", "confirm-incoming-pay-pull")
+peerCli
+ .subcommand("confirmIncomingPayPull", "confirm-pull-debit")
.requiredArgument("peerPullPaymentIncomingId", clk.STRING)
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.AcceptPeerPullPayment,
+ WalletApiOperation.ConfirmPeerPullDebit,
{
peerPullPaymentIncomingId:
args.confirmIncomingPayPull.peerPullPaymentIncomingId,
@@ -979,8 +998,24 @@ advancedCli
});
});
-advancedCli
- .subcommand("initiatePayPull", "initiate-pay-pull", {
+peerCli
+ .subcommand("confirmIncomingPayPush", "confirm-push-credit")
+ .requiredArgument("peerPushPaymentIncomingId", clk.STRING)
+ .action(async (args) => {
+ await withWallet(args, async (wallet) => {
+ const resp = await wallet.client.call(
+ WalletApiOperation.ConfirmPeerPushCredit,
+ {
+ peerPushPaymentIncomingId:
+ args.confirmIncomingPayPush.peerPushPaymentIncomingId,
+ },
+ );
+ console.log(JSON.stringify(resp, undefined, 2));
+ });
+ });
+
+peerCli
+ .subcommand("initiatePayPull", "initiate-pull-credit", {
help: "Initiate a peer-pull payment.",
})
.requiredArgument("amount", clk.STRING, {
@@ -993,7 +1028,7 @@ advancedCli
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.InitiatePeerPullPayment,
+ WalletApiOperation.InitiatePeerPullCredit,
{
exchangeBaseUrl: args.initiatePayPull.exchangeBaseUrl,
partialContractTerms: {
@@ -1013,27 +1048,23 @@ advancedCli
});
});
-advancedCli
- .subcommand("checkPayPush", "check-pay-push", {
- help: "Check fees for a peer-push payment.",
- })
- .requiredArgument("amount", clk.STRING, {
- help: "Amount to pay",
- })
+peerCli
+ .subcommand("preparePushCredit", "prepare-push-credit")
+ .requiredArgument("talerUri", clk.STRING)
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.PreparePeerPushPayment,
+ WalletApiOperation.PreparePeerPushCredit,
{
- amount: args.checkPayPush.amount,
+ talerUri: args.preparePushCredit.talerUri,
},
);
console.log(JSON.stringify(resp, undefined, 2));
});
});
-advancedCli
- .subcommand("payPush", "initiate-pay-push", {
+peerCli
+ .subcommand("payPush", "initiate-push-debit", {
help: "Initiate a peer-push payment.",
})
.requiredArgument("amount", clk.STRING, {
@@ -1045,7 +1076,7 @@ advancedCli
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
- WalletApiOperation.InitiatePeerPushPayment,
+ WalletApiOperation.InitiatePeerPushDebit,
{
partialContractTerms: {
amount: args.payPush.amount,
@@ -1064,6 +1095,10 @@ advancedCli
});
});
+const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
+ help: "Subcommands for advanced operations (only use if you know what you're doing!).",
+});
+
advancedCli
.subcommand("serve", "serve", {
help: "Serve the wallet API via a unix domain socket.",