Allow more then 20 accounts when using BTCPayServer.Vault (#4430)

Closes #4410.
This commit is contained in:
d11n 2022-12-14 04:06:54 +01:00 committed by GitHub
parent cdac238f6d
commit e9deb13ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 23 deletions

View File

@ -25,7 +25,7 @@
<div id="vault-status" class="mb-4"></div> <div id="vault-status" class="mb-4"></div>
<div id="vault-xpub" class="mt-4" style="display:none;"> <div id="vault-xpub" class="mt-4" style="display:none;">
<div class="form-group"> <div class="form-group">
<label for="addressType">Address type</label> <label for="addressType" class="form-label">Address type</label>
<select id="addressType" name="addressType" class="form-select w-auto"> <select id="addressType" name="addressType" class="form-select w-auto">
<option value="segwit">Segwit (Recommended, cheapest fee)</option> <option value="segwit">Segwit (Recommended, cheapest fee)</option>
<option value="segwitWrapped">Segwit wrapped (Compatible with old wallets)</option> <option value="segwitWrapped">Segwit wrapped (Compatible with old wallets)</option>
@ -37,13 +37,8 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="accountNumber">Account</label> <label for="accountNumber" class="form-label">Account</label>
<select id="accountNumber" name="accountNumber" class="form-select w-auto"> <input id="accountNumber" class="form-control" name="accountNumber" type="number" value="0" min="0" step="1" style="max-width:10ch;" />
@for (int i = 0; i < 20; i++)
{
<option value="@i">@i</option>
}
</select>
</div> </div>
</div> </div>
<div> <div>

View File

@ -245,6 +245,7 @@ var vaultui = (function () {
return await self.askForXPubs(); return await self.askForXPubs();
return false; return false;
} }
try {
var selectedXPubs = await self.getXpubSettings(); var selectedXPubs = await self.getXpubSettings();
self.bridge.socket.send(JSON.stringify(selectedXPubs)); self.bridge.socket.send(JSON.stringify(selectedXPubs));
show(VaultFeedbacks.fetchingXpubs); show(VaultFeedbacks.fetchingXpubs);
@ -257,6 +258,9 @@ var vaultui = (function () {
show(VaultFeedbacks.fetchedXpubs); show(VaultFeedbacks.fetchedXpubs);
self.xpub = json; self.xpub = json;
return true; return true;
} catch (err) {
showError({ error: true, message: err });
}
}; };
/** /**
@ -273,10 +277,13 @@ var vaultui = (function () {
$("#vault-xpub").css("display", "none"); $("#vault-xpub").css("display", "none");
$("#vault-confirm").css("display", "none"); $("#vault-confirm").css("display", "none");
$(this).unbind(); $(this).unbind();
resolve({ const addressType = $("select[name=\"addressType\"]").val();
addressType: $("select[name=\"addressType\"]").val(), const accountNumber = parseInt($("input[name=\"accountNumber\"]").val());
accountNumber: parseInt($("select[name=\"accountNumber\"]").val()) if (addressType && !isNaN(accountNumber)) {
}); resolve({ addressType, accountNumber });
} else {
reject("Provide an address type and account number")
}
}); });
}); });
}; };