wallet-cli: allow generating segwit addresses
This commit is contained in:
parent
dc2c2b3650
commit
68b4d0c4de
@ -45,6 +45,7 @@ import {
|
|||||||
rsaBlind,
|
rsaBlind,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
setGlobalLogLevelFromString,
|
setGlobalLogLevelFromString,
|
||||||
|
parsePaytoUri,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
NodeHttpLib,
|
NodeHttpLib,
|
||||||
@ -742,6 +743,18 @@ advancedCli
|
|||||||
fs.writeFileSync(1, decodeCrock(enc.trim()));
|
fs.writeFileSync(1, decodeCrock(enc.trim()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
advancedCli
|
||||||
|
.subcommand("genSegwit", "gen-segwit")
|
||||||
|
.requiredArgument("paytoUri", clk.STRING)
|
||||||
|
.requiredArgument("reservePub", clk.STRING)
|
||||||
|
.action(async (args) => {
|
||||||
|
const p = parsePaytoUri(args.genSegwit.paytoUri);
|
||||||
|
if (p?.isKnown && p?.targetType === "bitcoin") {
|
||||||
|
p.generateSegwitAddress(args.genSegwit.reservePub);
|
||||||
|
}
|
||||||
|
console.log(p);
|
||||||
|
});
|
||||||
|
|
||||||
advancedCli
|
advancedCli
|
||||||
.subcommand("withdrawManually", "withdraw-manually", {
|
.subcommand("withdrawManually", "withdraw-manually", {
|
||||||
help: "Withdraw manually from an exchange.",
|
help: "Withdraw manually from an exchange.",
|
||||||
|
@ -1016,6 +1016,15 @@ export async function getExchangeWithdrawalInfo(
|
|||||||
instructedAmount,
|
instructedAmount,
|
||||||
denoms,
|
denoms,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (selectedDenoms.selectedDenoms.length === 0) {
|
||||||
|
throw Error(
|
||||||
|
`unable to withdraw from ${exchangeBaseUrl}, can't select denominations for instructed amount (${Amounts.stringify(
|
||||||
|
instructedAmount,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const exchangeWireAccounts: string[] = [];
|
const exchangeWireAccounts: string[] = [];
|
||||||
for (const account of exchangeDetails.wireInfo.accounts) {
|
for (const account of exchangeDetails.wireInfo.accounts) {
|
||||||
exchangeWireAccounts.push(account.payto_uri);
|
exchangeWireAccounts.push(account.payto_uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user