Skip to content

Commit

Permalink
Enable sending native USDC in mainnet behind a trial
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Jan 5, 2024
1 parent fde6780 commit d2f1614
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
32 changes: 26 additions & 6 deletions src/components/layouts/AddressOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,22 @@
<Amount :amount="usdcAddressInfo.nativeBalance" currency="usdc" value-mask/>
</div>
<div class="flex-row">
<div class="flex-grow"></div>
<router-link
:to="{ name: 'send-usdc', params: {token: config.usdc.nativeUsdcContract }}"
class="nq-button-s"
>Send</router-link>
<template v-if="config.environment !== 'main' || sendingNativeUsdcTrialEnabled">
<router-link
:to="{ name: 'send-usdc', params: {token: config.usdc.nativeUsdcContract }}"
class="nq-button-s"
>Send</router-link>
</template>
<template v-else>
<span class="nq-orange">
<AlertTriangleIcon />
{{ $t('Sending Native Polygon USDC is not yet supported.') }}
</span>
<div class="flex-grow"></div>
<!-- eslint-disable-next-line max-len -->
<a href="https://forum.nimiq.community/t/important-update-on-usdc-support-in-nimiq-wallet-native-usdc/1927"
target="_blank" rel="noopener" class="nq-button-s">How to transfer</a>
</template>
</div>
</div>
<div class="scroll-mask top"></div>
Expand Down Expand Up @@ -221,14 +232,15 @@
</template>

<script lang="ts">
import { defineComponent, ref, watch } from '@vue/composition-api';
import { computed, defineComponent, ref, watch } from '@vue/composition-api';
import {
Identicon,
GearIcon,
Copyable,
ArrowRightSmallIcon,
ArrowLeftIcon,
MenuDotsIcon,
AlertTriangleIcon,
} from '@nimiq/vue-components';
// @ts-expect-error missing types for this package
import { Portal } from '@linusborg/vue-simple-portal';
Expand All @@ -250,6 +262,8 @@ import { useAccountStore } from '../../stores/Account';
import { useAddressStore } from '../../stores/Address';
import { useBtcAddressStore } from '../../stores/BtcAddress';
import { useUsdcAddressStore } from '../../stores/UsdcAddress';
import { useSettingsStore } from '../../stores/Settings';
import { Trial } from '../../lib/Trials';
import { onboard, rename } from '../../hub';
import { useElementResize } from '../../composables/useElementResize';
import { useWindowSize } from '../../composables/useWindowSize';
Expand Down Expand Up @@ -354,6 +368,10 @@ export default defineComponent({
const { config } = useConfig();
const { trials } = useSettingsStore();
const sendingNativeUsdcTrialEnabled = computed(() => trials.value.includes(Trial.SEND_NATIVE_USDC));
return {
activeCurrency,
searchString,
Expand All @@ -378,10 +396,12 @@ export default defineComponent({
addressMasked,
toggleUnclaimedCashlinkList,
config,
sendingNativeUsdcTrialEnabled,
};
},
components: {
ArrowRightSmallIcon,
AlertTriangleIcon,
Identicon,
BitcoinIcon,
GearIcon,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/Trials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ window.digestMessage = async function (message: string): Promise<string> { // es
export enum Trial {
OASIS2 = 'OASIS2',
TEN31Pass = 'TEN31Pass',
SEND_NATIVE_USDC = 'Send native USDC',
}

export function init() {
Expand Down Expand Up @@ -46,6 +47,7 @@ export async function enableTrial(password: string): Promise<boolean> {
const trialToEnable = {
'a3c06b88640ae4a5344a94238aa12746b032634bba1431163137129fe6ee1230': Trial.OASIS2,
'd8082502f1f6cf61125f9d87b1a848590a5c56aa593abcb59f5d3225afdfc8b0': Trial.TEN31Pass,
'a664dfc3e313193aa2b33a9bd3cf179c31d8ed4a1eb4f7d5bf655269c4c996d5': Trial.SEND_NATIVE_USDC,
}[hash];
/* eslint-enable quote-props */

Expand Down

0 comments on commit d2f1614

Please sign in to comment.