feat: add network for wallet accounts
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
<div>
|
||||
<a
|
||||
style="color: unset"
|
||||
:href="mempoolEndpoint + '/address/' + props.row.address"
|
||||
:href="'https://'+ mempoolEndpoint + '/address/' + props.row.address"
|
||||
target="_blank"
|
||||
>
|
||||
{{props.row.address}}</a
|
||||
|
||||
@@ -8,11 +8,7 @@ async function walletConfig(path) {
|
||||
data: function () {
|
||||
return {
|
||||
networOptions: ['Mainnet', 'Testnet'],
|
||||
internalConfig: {
|
||||
mempool_endpoint: 'https://mempool.space',
|
||||
receive_gap_limit: 20,
|
||||
change_gap_limit: 5
|
||||
},
|
||||
internalConfig: {},
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ async function walletList(path) {
|
||||
name: 'wallet-list',
|
||||
template,
|
||||
|
||||
props: ['adminkey', 'inkey', 'sats-denominated', 'addresses'],
|
||||
props: ['adminkey', 'inkey', 'sats-denominated', 'addresses', 'network'],
|
||||
data: function () {
|
||||
return {
|
||||
walletAccounts: [],
|
||||
@@ -47,6 +47,15 @@ async function walletList(path) {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
immediate: true,
|
||||
async network(newNet, oldNet) {
|
||||
console.log('### newNet, oldNet', newNet, oldNet)
|
||||
if (newNet !== oldNet) {
|
||||
await this.refreshWalletAccounts()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
satBtc(val, showUnit = true) {
|
||||
@@ -55,6 +64,7 @@ async function walletList(path) {
|
||||
|
||||
addWalletAccount: async function () {
|
||||
const data = _.omit(this.formDialog.data, 'wallet')
|
||||
data.network = this.network
|
||||
await this.createWalletAccount(data)
|
||||
},
|
||||
createWalletAccount: async function (data) {
|
||||
@@ -106,7 +116,7 @@ async function walletList(path) {
|
||||
try {
|
||||
const {data} = await LNbits.api.request(
|
||||
'GET',
|
||||
'/watchonly/api/v1/wallet',
|
||||
`/watchonly/api/v1/wallet/?network=${this.network}`,
|
||||
this.inkey
|
||||
)
|
||||
return data
|
||||
|
||||
@@ -47,14 +47,15 @@ const watchOnly = async () => {
|
||||
showAddress: false,
|
||||
addressNote: '',
|
||||
showPayment: false,
|
||||
fetchedUtxos: false
|
||||
fetchedUtxos: false,
|
||||
network: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
mempoolHostname() {
|
||||
mempoolHostname: function () {
|
||||
if (!this.config.isLoaded) return
|
||||
const hostname = new URL(this.config.mempool_endpoint).hostname
|
||||
if (this.config.network === 'testnet') {
|
||||
let hostname = new URL(this.config.mempool_endpoint).hostname
|
||||
if (this.config.network === 'Testnet') {
|
||||
hostname += '/testnet'
|
||||
}
|
||||
return hostname
|
||||
|
||||
Reference in New Issue
Block a user