Skip to content

Commit

Permalink
Allow disabling Fastspot swaps in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed May 19, 2022
1 parent de60f9a commit 19d24c5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/components/BalanceDistribution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
: false }"
value-mask/>
</div>
<div v-if="hasBitcoinAddresses && $config.enableBitcoin" class="exchange" ref="$exchange">

<div v-if="hasBitcoinAddresses && $config.enableBitcoin && $config.fastspot.enabled"
class="exchange" ref="$exchange"
>
<Tooltip class="btc" preferredPosition="top right" :disabled="hasActiveSwap" ref="swapTooltip" noFocus>
<button
:disabled="!totalFiatAccountBalance || hasActiveSwap || !canUseSwaps"
Expand All @@ -67,6 +70,8 @@
</i18n>
</Tooltip>
</div>
<div v-else-if="hasBitcoinAddresses && $config.enableBitcoin" class="separator"></div>

<div v-if="hasBitcoinAddresses && $config.enableBitcoin"
class="currency flex-column btc"
:style="{width: Math.max(0.12, balanceDistribution.btc) * 100 + '%'}"
Expand Down Expand Up @@ -292,6 +297,15 @@ export default defineComponent({
}
}
.separator {
width: 0.25rem;
background: var(--nimiq-highlight-bg);
margin: 0.5rem 0.75rem 0 1rem;
height: 4rem;
border-radius: 1rem;
flex-shrink: 0;
}
.currency {
justify-content: space-around;
align-content: center;
Expand Down
6 changes: 4 additions & 2 deletions src/components/layouts/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
</div>

<div class="trade-actions" v-show="!isLegacyAccount">
<button class="nq-button-pill light-blue inverse"
<button v-if="$config.fastspot.enabled || $config.moonpay.enabled || $config.simplex.enabled"
class="nq-button-pill light-blue inverse"
@click="$router.push('/buy?sidebar=true')" @mousedown.prevent
:disabled="$route.name !== 'root' || hasActiveSwap"
>{{ $t('Buy') }}</button>

<button class="nq-button-s inverse"
<button v-if="$config.fastspot.enabled"
class="nq-button-s inverse"
@click="$router.push('/sell-crypto?sidebar=true')" @mousedown.prevent
:disabled="$route.name !== 'root' || hasActiveSwap || !canUseSwaps"
>{{ $t('Sell') }}</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/modals/BuyOptionsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export default defineComponent({
const isOasisUnderMaintenance = ref(false);
const isOasisAvailable = computed(() => {
if (!Config.fastspot.enabled) return false;
if (!canUseSwaps.value) return false;
if (isOasisUnderMaintenance.value) return false;
if (!country.value) return true;
Expand Down
1 change: 1 addition & 0 deletions src/config/config.local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
pageVisibilityTxRefreshInterval: 1 * 60e3, // 1 minute

fastspot: {
enabled: true,
apiEndpoint: 'https://api.test.fastspot.io/fast/v1',
// This is a publishable key
apiKey: 'd011aeea-41cf-4c05-a31d-436495bed9b7',
Expand Down
1 change: 1 addition & 0 deletions src/config/config.mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
pageVisibilityTxRefreshInterval: 5 * 60e3, // 5 minutes

fastspot: {
enabled: true,
apiEndpoint: 'https://api.go.fastspot.io/fast/v1',
// This is a publishable key
apiKey: 'c20d43d0-8f60-4fca-a298-85e80f64d042',
Expand Down
1 change: 1 addition & 0 deletions src/config/config.testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
pageVisibilityTxRefreshInterval: 2 * 60e3, // 2 minutes

fastspot: {
enabled: true,
apiEndpoint: 'https://api.test.fastspot.io/fast/v1',
// This is a publishable key
apiKey: 'd011aeea-41cf-4c05-a31d-436495bed9b7',
Expand Down

0 comments on commit 19d24c5

Please sign in to comment.