feat: fix mempool endpint

This commit is contained in:
Vlad Stan 2022-07-29 18:42:05 +03:00
parent 51c8b58fdb
commit 657ed7a37c
14 changed files with 50 additions and 19 deletions

View file

@ -65,7 +65,7 @@
<div> <div>
<a <a
style="color: unset" style="color: unset"
:href="mempool_endpoint + '/address/' + props.row.address" :href="mempoolEndpoint + '/address/' + props.row.address"
target="_blank" target="_blank"
> >
{{props.row.address}}</a {{props.row.address}}</a

View file

@ -7,7 +7,7 @@ async function addressList(path) {
props: [ props: [
'addresses', 'addresses',
'accounts', 'accounts',
'mempool_endpoint', 'mempool-endpoint',
'inkey', 'inkey',
'sats-denominated' 'sats-denominated'
], ],

View file

@ -4,7 +4,7 @@ async function feeRate(path) {
name: 'fee-rate', name: 'fee-rate',
template, template,
props: ['rate', 'fee-value', 'sats-denominated'], props: ['rate', 'fee-value', 'sats-denominated', 'mempool-endpoint'],
computed: { computed: {
feeRate: { feeRate: {
@ -37,7 +37,9 @@ async function feeRate(path) {
refreshRecommendedFees: async function () { refreshRecommendedFees: async function () {
const { const {
bitcoin: {fees: feesAPI} bitcoin: {fees: feesAPI}
} = mempoolJS() } = mempoolJS({
hostname: new URL(this.mempoolEndpoint).hostname
})
const fn = async () => feesAPI.getFeesRecommended() const fn = async () => feesAPI.getFeesRecommended()
this.recommededFees = await retryWithDelay(fn) this.recommededFees = await retryWithDelay(fn)

View file

@ -82,7 +82,7 @@
<a <a
v-if="!props.row.sameTxItems" v-if="!props.row.sameTxItems"
style="color: unset" style="color: unset"
:href="mempool_endpoint + '/address/' + props.row.address" :href="mempoolEndpoint + '/address/' + props.row.address"
target="_blank" target="_blank"
> >
{{props.row.address}}</a {{props.row.address}}</a
@ -106,7 +106,7 @@
<div class="col-10 q-pr-lg"> <div class="col-10 q-pr-lg">
<a <a
style="color: unset" style="color: unset"
:href="mempool_endpoint + '/tx/' + props.row.txId" :href="mempoolEndpoint + '/tx/' + props.row.txId"
target="_blank" target="_blank"
> >
{{props.row.txId}}</a {{props.row.txId}}</a

View file

@ -4,7 +4,7 @@ async function history(path) {
name: 'history', name: 'history',
template, template,
props: ['history', 'mempool_endpoint', 'sats-denominated'], props: ['history', 'mempool-endpoint', 'sats-denominated'],
data: function () { data: function () {
return { return {
historyTable: { historyTable: {

View file

@ -2,6 +2,7 @@
<q-form @submit="checkAndSend" ref="paymentFormRef" class="q-gutter-md"> <q-form @submit="checkAndSend" ref="paymentFormRef" class="q-gutter-md">
<q-card class="q-mt-lg"> <q-card class="q-mt-lg">
<q-card-section> <q-card-section>
<send-to <send-to
:data.sync="sendToList" :data.sync="sendToList"
:fee-rate="feeRate" :fee-rate="feeRate"
@ -17,6 +18,7 @@
<q-card-section> <q-card-section>
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<div class="col-4"> <div class="col-4">
{{mempoolEndpoint}}xxxxxx1
<q-toggle <q-toggle
label="Show Custom Fee" label="Show Custom Fee"
color="secodary" color="secodary"
@ -40,7 +42,7 @@
<div v-show="showCustomFee" class="row items-center no-wrap q-mt-md"> <div v-show="showCustomFee" class="row items-center no-wrap q-mt-md">
<div class="col-12"> <div class="col-12">
<q-separator class="q-mb-md"></q-separator> <q-separator class="q-mb-md"></q-separator>
<fee-rate :fee-value="feeValue" :rate.sync="feeRate"></fee-rate> <fee-rate :fee-value="feeValue" :rate.sync="feeRate" :mempool-endpoint="mempoolEndpoint"></fee-rate>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
@ -78,7 +80,7 @@
:utxos="utxos" :utxos="utxos"
:selectable="true" :selectable="true"
:payed-amount="totalPayedAmount" :payed-amount="totalPayedAmount"
:mempool_endpoint="mempool_endpoint" :mempool-endpoint="mempoolEndpoint"
:sats-denominated="satsDenominated" :sats-denominated="satsDenominated"
></utxo-list> ></utxo-list>
</div> </div>

View file

@ -8,7 +8,7 @@ async function payment(path) {
'accounts', 'accounts',
'addresses', 'addresses',
'utxos', 'utxos',
'mempool_endpoint', 'mempool-endpoint',
'sats-denominated', 'sats-denominated',
'serial-signer-ref', 'serial-signer-ref',
'adminkey' 'adminkey'
@ -291,7 +291,9 @@ async function payment(path) {
fetchTxHex: async function (txId) { fetchTxHex: async function (txId) {
const { const {
bitcoin: {transactions: transactionsAPI} bitcoin: {transactions: transactionsAPI}
} = mempoolJS() // todo: hostname } = mempoolJS({
hostname: new URL(this.mempoolEndpoint).hostname
})
try { try {
const response = await transactionsAPI.getTxHex({txid: txId}) const response = await transactionsAPI.getTxHex({txid: txId})

View file

@ -89,7 +89,7 @@
<div> <div>
<a <a
style="color: unset" style="color: unset"
:href="mempool_endpoint + '/address/' + props.row.address" :href="mempoolEndpoint + '/address/' + props.row.address"
target="_blank" target="_blank"
> >
{{props.row.address}}</a {{props.row.address}}</a
@ -120,7 +120,7 @@
<div class="col-10 q-pr-lg"> <div class="col-10 q-pr-lg">
<a <a
style="color: unset" style="color: unset"
:href="mempool_endpoint + '/tx/' + props.row.txId" :href="mempoolEndpoint + '/tx/' + props.row.txId"
target="_blank" target="_blank"
> >
{{props.row.txId}}</a {{props.row.txId}}</a

View file

@ -10,7 +10,7 @@ async function utxoList(path) {
'selectable', 'selectable',
'payed-amount', 'payed-amount',
'sats-denominated', 'sats-denominated',
'mempool_endpoint' 'mempool-endpoint'
], ],
data: function () { data: function () {

View file

@ -51,6 +51,15 @@
label="Change Gap Limit" label="Change Gap Limit"
></q-input> ></q-input>
<q-select
filled
dense
emit-value
v-model="config.data.network"
:options="networOptions"
label="Network"
></q-select>
<q-toggle <q-toggle
:label="config.data.sats_denominated ? 'sats denominated' : 'BTC denominated'" :label="config.data.sats_denominated ? 'sats denominated' : 'BTC denominated'"
color="secodary" color="secodary"

View file

@ -168,6 +168,15 @@
label="Account Extended Public Key; xpub, ypub, zpub; Bitcoin Descriptor" label="Account Extended Public Key; xpub, ypub, zpub; Bitcoin Descriptor"
></q-input> ></q-input>
<q-select
filled
dense
emit-value
v-model="formDialog.data.network"
:options="networOptions"
label="Network"
></q-select>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn <q-btn
unelevated unelevated

View file

@ -14,6 +14,7 @@ async function walletList(path) {
data: {} data: {}
}, },
filter: '', filter: '',
networOptions: ['Mainnet', 'Testnet'],
walletsTable: { walletsTable: {
columns: [ columns: [
{ {

View file

@ -323,7 +323,9 @@ const watchOnly = async () => {
getAddressTxsDelayed: async function (addrData) { getAddressTxsDelayed: async function (addrData) {
const { const {
bitcoin: {addresses: addressesAPI} bitcoin: {addresses: addressesAPI}
} = mempoolJS() } = mempoolJS({
hostname: new URL(this.config.data.mempool_endpoint).hostname
})
const fn = async () => const fn = async () =>
addressesAPI.getAddressTxs({ addressesAPI.getAddressTxs({
@ -336,7 +338,9 @@ const watchOnly = async () => {
getAddressTxsUtxoDelayed: async function (address) { getAddressTxsUtxoDelayed: async function (address) {
const { const {
bitcoin: {addresses: addressesAPI} bitcoin: {addresses: addressesAPI}
} = mempoolJS() } = mempoolJS({
hostname: new URL(this.config.data.mempool_endpoint).hostname
})
const fn = async () => const fn = async () =>
addressesAPI.getAddressTxsUtxo({ addressesAPI.getAddressTxsUtxo({

View file

@ -89,7 +89,7 @@
ref="addressList" ref="addressList"
:addresses="addresses" :addresses="addresses"
:accounts="walletAccounts" :accounts="walletAccounts"
:mempool_endpoint="config.data.mempool_endpoint" :mempool-endpoint="config.data.mempool_endpoint"
:sats-denominated="config.data.sats_denominated" :sats-denominated="config.data.sats_denominated"
@scan:address="scanAddress" @scan:address="scanAddress"
@show-address-details="showAddressDetails" @show-address-details="showAddressDetails"
@ -101,14 +101,14 @@
<q-tab-panel name="history"> <q-tab-panel name="history">
<history <history
:history="history" :history="history"
:mempool_endpoint="config.data.mempool_endpoint" :mempool-endpoint="config.data.mempool_endpoint"
:sats-denominated="config.data.sats_denominated" :sats-denominated="config.data.sats_denominated"
></history> ></history>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="utxos"> <q-tab-panel name="utxos">
<utxo-list <utxo-list
:utxos="utxos.data" :utxos="utxos.data"
:mempool_endpoint="config.data.mempool_endpoint" :mempool-endpoint="config.data.mempool_endpoint"
:sats-denominated="config.data.sats_denominated" :sats-denominated="config.data.sats_denominated"
></utxo-list> ></utxo-list>
</q-tab-panel> </q-tab-panel>
@ -116,12 +116,14 @@
</q-card-section> </q-card-section>
</q-card> </q-card>
<div class="q-pt-sm"> <div class="q-pt-sm">
{{config.data.mempool_endpoint}}
<payment <payment
ref="paymentRef" ref="paymentRef"
v-show="showPayment" v-show="showPayment"
:accounts="walletAccounts" :accounts="walletAccounts"
:addresses="addresses" :addresses="addresses"
:utxos="utxos.data" :utxos="utxos.data"
:mempool-endpoint="config.data.mempool_endpoint"
:adminkey="g.user.wallets[0].adminkey" :adminkey="g.user.wallets[0].adminkey"
:serial-signer-ref="$refs.serialSigner" :serial-signer-ref="$refs.serialSigner"
></payment> ></payment>