Skip to content

Commit 3db9187

Browse files
committed
Add config option to disable network interaction
1 parent 77fd5fd commit 3db9187

File tree

12 files changed

+23
-15
lines changed

12 files changed

+23
-15
lines changed

src/components/MobileActionBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</button>
66
<button class="send nq-button-pill light-blue flex-row"
77
@click="send" @mousedown.prevent
8-
:disabled="sendDisabled"
8+
:disabled="$config.disableNetworkInteraction || sendDisabled"
99
>
1010
<ArrowRightSmallIcon />{{ $t('Send') }}
1111
</button>

src/components/layouts/AccountOverview.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
</div>
6363

6464
<Tooltip
65-
v-if="$config.fastspot.enabled
65+
v-if="!$config.disableNetworkInteraction
66+
&& $config.fastspot.enabled
6667
&& hasBitcoinAddresses && $config.enableBitcoin
6768
&& (nimAccountBalance > 0 || btcAccountBalance > 0)"
6869
class="nim-btc-swap-button"
@@ -84,7 +85,8 @@
8485
</Tooltip>
8586

8687
<Tooltip
87-
v-if="$config.fastspot.enabled
88+
v-if="!$config.disableNetworkInteraction
89+
&& $config.fastspot.enabled
8890
&& activeAccountInfo && activeAccountInfo.type !== AccountType.LEDGER
8991
&& hasPolygonAddresses && $config.polygon.enabled
9092
&& (
@@ -154,7 +156,8 @@
154156
</button>
155157

156158
<Tooltip
157-
v-if="$config.fastspot.enabled
159+
v-if="!$config.disableNetworkInteraction
160+
&& $config.fastspot.enabled
158161
&& activeAccountInfo && activeAccountInfo.type !== AccountType.LEDGER
159162
&& hasBitcoinAddresses && $config.enableBitcoin
160163
&& hasPolygonAddresses && $config.polygon.enabled

src/components/layouts/AddressOverview.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@
182182

183183
<button class="send nq-button-pill light-blue flex-row"
184184
@click="$router.push(`/send/${activeCurrency}`)" @mousedown.prevent
185-
:disabled="(activeCurrency === 'nim' && (!activeAddressInfo || !activeAddressInfo.balance))
185+
:disabled="$config.disableNetworkInteraction
186+
|| (activeCurrency === 'nim' && (!activeAddressInfo || !activeAddressInfo.balance))
186187
|| (activeCurrency === 'btc' && !btcAccountBalance)
187188
|| (activeCurrency === 'usdc' && !accountUsdcBalance /* can only send native usdc */)
188189
|| (activeCurrency === CryptoCurrency.USDT && !accountUsdtBridgedBalance)"

src/components/layouts/Sidebar.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<template #trigger>
5353
<button
5454
class="nq-button-s inverse"
55-
:disabled="hasActiveSwap"
55+
:disabled="$config.disableNetworkInteraction || hasActiveSwap"
5656
@click="openModal('buy')"
5757
@mousedown.prevent="hideTooltips"
5858
>{{ $t('Buy') }}</button>
@@ -74,7 +74,7 @@
7474
>
7575
<template #trigger>
7676
<button class="nq-button-s inverse"
77-
:disabled="!canSellCryptoWithMoonpay"
77+
:disabled="$config.disableNetworkInteraction || !canSellCryptoWithMoonpay"
7878
@click="openModal('moonpay-sell-info')"
7979
@mousedown.prevent="hideTooltips"
8080
>{{ $t('Sell') }}</button>
@@ -130,7 +130,8 @@
130130
>
131131
<template #trigger>
132132
<button
133-
:disabled="fastspotEnabledCryptoSwapAssets.length <= 1
133+
:disabled="$config.disableNetworkInteraction
134+
|| fastspotEnabledCryptoSwapAssets.length <= 1
134135
|| walletActivatedCurrencies.length <= 1
135136
|| !hasSwappableBalance
136137
|| !canUseSwaps

src/components/modals/BuyCryptoModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
v-if="!insufficientLimit || !$config.ten31Pass.enabled || kycUser"
192192
:assets="[activeCurrency]"
193193
:buttonColor="kycUser ? 'purple' : 'light-blue'"
194-
:disabled="!canSign"
194+
:disabled="$config.disableNetworkInteraction || !canSign"
195195
:error="estimateError || swapError"
196196
:requireCompleteBtcHistory="false"
197197
@click="sign"

src/components/modals/SellCryptoModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
v-if="!insufficientLimit || !$config.ten31Pass.enabled || kycUser"
173173
:assets="[activeCurrency]"
174174
:buttonColor="kycUser ? 'purple' : 'light-blue'"
175-
:disabled="!canSign"
175+
:disabled="$config.disableNetworkInteraction || !canSign"
176176
:error="estimateError || swapError"
177177
requireCompleteBtcHistory
178178
@click="sign"

src/components/modals/SendModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
</PageBody>
203203
<SendModalFooter
204204
:assets="[CryptoCurrency.NIM]"
205-
:disabled="!canSend"
205+
:disabled="$config.disableNetworkInteraction || !canSend"
206206
@click="sign"
207207
><template #cta>{{ $t('Send {currency}', { currency: 'NIM' }) }}</template></SendModalFooter>
208208
</div>

src/components/staking/StakingButton.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
v-if="!totalActiveStake && activeAddressInfo && activeAddressInfo.balance"
55
preferredPosition="bottom"
66
:container="$parent.$el ? { $el: $parent.$el } : undefined"
7-
:disabled="isCTATooltipDisabled"
7+
:disabled="$config.disableNetworkInteraction || isCTATooltipDisabled"
88
>
99
<span>
1010
{{ $t('Earn NIM every month by staking your NIM') }}
@@ -14,11 +14,11 @@
1414
<Tooltip class="staking-button-tooltip" ref="$tooltip"
1515
preferredPosition="top"
1616
:container="$parent.$el ? { $el: $parent.$el } : undefined"
17-
:disabled="!isCTATooltipDisabled"
17+
:disabled="$config.disableNetworkInteraction || !isCTATooltipDisabled"
1818
>
1919
<div slot="trigger">
2020
<button class="stake"
21-
:disabled="!canStake"
21+
:disabled="$config.disableNetworkInteraction || !canStake"
2222
@click="$router.push('/staking')"
2323
@mousedown.prevent
2424
>

src/components/swap/SwapModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
v-if="!isLimitReached || !$config.ten31Pass.enabled || kycUser"
187187
:assets="[assetToCurrency(leftAsset), assetToCurrency(rightAsset)]"
188188
:buttonColor="kycUser ? 'purple' : 'light-blue'"
189-
:disabled="!canSign || currentlySigning"
189+
:disabled="$config.disableNetworkInteraction || !canSign || currentlySigning"
190190
:error="disabledAssetError || estimateError || swapError || polygonFeeError"
191191
requireCompleteBtcHistory
192192
@click="sign"

src/config/config.local.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default {
1313
'/dns4/seed3.pos.nimiq-testnet.com/tcp/8443/wss',
1414
'/dns4/seed4.pos.nimiq-testnet.com/tcp/8443/wss',
1515
],
16+
disableNetworkInteraction: true,
1617
faucetEndpoint: 'https://faucet.pos.nimiq-testnet.com',
1718
reportToSentry: false,
1819
enableBitcoin: true,

0 commit comments

Comments
 (0)