Skip to content

Commit

Permalink
Merge pull request #1583 from aeternity/drop-preclaim
Browse files Browse the repository at this point in the history
Drop name preclaim
  • Loading branch information
davidyuk authored Feb 18, 2025
2 parents 8fb9fe3 + e3b983a commit cc46630
Show file tree
Hide file tree
Showing 32 changed files with 23 additions and 163 deletions.
21 changes: 2 additions & 19 deletions src/components/mobile/AccountSwitcherModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
<Overlay class="account-switcher-modal" @click="resolve">
<AeCard fill="maximum">
<ListItemAccount
v-for="(account, index) in accountsWithNamePending"
v-for="(account, index) in accounts"
:key="account.address"
v-bind="account"
>
<template slot="right">
<NamePending v-if="account.namePending" />
<AeRadio :checked="index === activeIdx" @change="setActiveIdx(index)" />
</template>
</ListItemAccount>
Expand Down Expand Up @@ -45,7 +44,6 @@ import { pick } from 'lodash-es';
import Overlay from '../Overlay.vue';
import ListItem from '../ListItem.vue';
import ListItemAccount from '../ListItemAccount.vue';
import NamePending from './NamePending.vue';
import ListItemCircle from '../ListItemCircle.vue';
import { Plus } from '../icons';
import AeCard from '../AeCard.vue';
Expand All @@ -58,7 +56,6 @@ export default {
Overlay,
ListItem,
ListItemAccount,
NamePending,
ListItemCircle,
Plus,
AeCard,
Expand All @@ -69,17 +66,7 @@ export default {
props: {
resolve: { type: Function, required: true },
},
computed: {
...mapState('accounts', ['activeIdx']),
...mapState('names', {
accountsWithNamePending(state, { get, isPending }) {
return this.accounts.map((account) => ({
...account,
namePending: isPending(get(account.address)),
}));
},
}),
},
computed: mapState('accounts', ['activeIdx']),
subscriptions() {
return pick(this.$store.state.observables, ['accounts', 'totalBalance']);
},
Expand Down Expand Up @@ -131,10 +118,6 @@ export default {
align-self: center;
}
.name-pending {
margin-right: functions.rem(8px);
}
.list-item.vault-new .list-item-circle {
background-color: variables.$color-alternative;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mobile/ConfirmTransactionSignModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<script>
import { mapState } from 'vuex';
import { Tag } from '@aeternity/aepp-sdk-next';
import { Tag, isAuctionName } from '@aeternity/aepp-sdk-next';
import Page from '../Page.vue';
import Guide from '../Guide.vue';
import AeFraction from '../AeFraction.vue';
Expand Down Expand Up @@ -100,7 +100,7 @@ export default {
guideTemplate() {
const { tag } = this.transaction;
if (tag === Tag.SpendTx) return this.$t('modal.confirm-transaction-sign.guide-spend');
if (tag === Tag.NameClaimTx && !+this.transaction.nameSalt) {
if (tag === Tag.NameClaimTx && isAuctionName(this.transaction.name)) {
return this.$t('modal.confirm-transaction-sign.guide-name-bid');
}
return this.$t('modal.confirm-transaction-sign.guide', {
Expand Down
29 changes: 0 additions & 29 deletions src/components/mobile/NamePending.vue

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const MAGNITUDE_MICRO = -6;
export const MAGNITUDE_PICO = -12;

export const AENS_DOMAIN = '.chain';
export const MAX_AUCTION_NAME_LENGTH = 12 + AENS_DOMAIN.length;

export const NAME_LIST_ROUTE_NAMES = ['name-list', 'auction-list', 'auction-list-character-length'];

Expand Down
1 change: 0 additions & 1 deletion src/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@
"confirm-bidding": "An auction for the name {name} has already started. Would you like to make a bid?",

"notification": {
"claim-sent": "为{name} 的名称已成功发送",
"registered": "{name} 已成功注册",
"bid": "You bid on {name} successfully",
"unknown-error": "因为未知原因,{name} 未注册"
Expand Down
1 change: 0 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@
"confirm-bidding": "An auction for the name {name} has already started. Would you like to make a bid?",

"notification": {
"claim-sent": "Claim for {name} name was successfully sent",
"registered": "{name} was successfully registered",
"bid": "You bid on {name} successfully",
"unknown-error": "{name} was not registered for unknown reason"
Expand Down
1 change: 0 additions & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@
"confirm-bidding": "An auction for the name {name} has already started. Would you like to make a bid?",

"notification": {
"claim-sent": "La solicitud de {name} nombre se envió correctamente",
"registered": "{name} se registró correctamente",
"bid": "You bid on {name} successfully",
"unknown-error": "{name} no se registró por un motivo desconocido"
Expand Down
1 change: 0 additions & 1 deletion src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@
"confirm-bidding": "Аукцион на имя {name} уже начался. Хотите сделать ставку?",

"notification": {
"claim-sent": "Запрос на имя {name} был успешно отправлен​​",
"registered": "{name} было успешно зарегистрировано",
"bid": "Вы успешно поставили на {name}",
"unknown-error": "{name} не было зарегистрировано по неизвестной причине"
Expand Down
2 changes: 2 additions & 0 deletions src/pages/aens/AuctionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export default {
async updateBids() {
const { data } = await this.$store.getters.middleware
// TODO: show more than 100 bids
// TODO: use /v3/names/auction.chain/claims instead
// TODO: remove previous bids after solving https://github.com/aeternity/ae_mdw/issues/2097
.getAccountActivities(produceNameId(this.name), { limit: 100 });
this.bids = data
.filter(({ type }) => type === 'NameClaimEvent')
Expand Down
11 changes: 4 additions & 7 deletions src/pages/aens/NameList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
:name="entry.name"
:to="{ name: 'name-details', params: { name: entry.name } }"
subtitle="address"
>
<NamePending v-if="entry.status === 'pending'" slot="right" />
</ListItemAccount>
/>
</AeCard>
</template>

Expand Down Expand Up @@ -48,7 +46,6 @@ import Page from '../../components/Page.vue';
import NameListHeader from '../../components/mobile/NameListHeader.vue';
import AeCard from '../../components/AeCard.vue';
import ListItemAccount from '../../components/ListItemAccount.vue';
import NamePending from '../../components/mobile/NamePending.vue';
import ButtonAddFixed from '../../components/ButtonAddFixed.vue';
import { MAGNITUDE } from '../../lib/constants';
Expand All @@ -58,7 +55,6 @@ export default {
NameListHeader,
AeCard,
ListItemAccount,
NamePending,
ButtonAddFixed,
},
data: () => ({ auctions: [] }),
Expand Down Expand Up @@ -97,11 +93,12 @@ export default {
.map(({ tx: { name } }) => name.toLowerCase())
.filter((name) => isNameValid(name) && isAuctionName(name)),
);
const nodeNoRetry = new Node(this.$store.getters.node.$host, { retryCount: 0 });
this.auctions = (
await Promise.allSettled(
recentlyClaimedNames.map((name) =>
nodeNoRetry.getAuctionEntryByName(name).then((entry) => ({ ...entry, name })),
this.$store.getters.node
.getAuctionEntryByName(name)
.then((entry) => ({ ...entry, name })),
),
)
)
Expand Down
29 changes: 6 additions & 23 deletions src/pages/aens/NameNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

<script>
import { mapGetters } from 'vuex';
import { Name } from '@aeternity/aepp-sdk-next';
import { MAX_AUCTION_NAME_LENGTH } from '../../lib/constants';
import { Name, isAuctionName } from '@aeternity/aepp-sdk-next';
import { handleUnknownError, isNotFoundError } from '../../lib/utils';
import { i18n } from '../../store/plugins/ui/languages';
import Page from '../../components/Page.vue';
Expand Down Expand Up @@ -83,27 +82,9 @@ export default {
}
const name = new Name(this.name, this.$store.getters.sdk.getContext());
let claimTxHash;
try {
await name.preclaim();
claimTxHash = (await name.claim({ waitMined: false })).hash;
this.$store.dispatch('modals/open', {
name: 'notification',
text: this.$t('name.new.notification.claim-sent', { name: this.name }),
});
this.$router.push({ name: 'name-list' });
} catch (e) {
if (e.message === 'Rejected by user') return;
this.error = true;
handleUnknownError(e);
} finally {
this.busy = false;
}
try {
this.$store.dispatch('names/fetchOwned');
await this.$store.getters.sdk.poll(claimTxHash);
const isAuction = MAX_AUCTION_NAME_LENGTH >= this.name.length;
await name.claim();
const isAuction = isAuctionName(this.name);
if (!isAuction) {
await this.$store.dispatch('names/updatePointer', {
name: this.name,
Expand All @@ -116,15 +97,17 @@ export default {
? i18n.t('name.new.notification.bid', { name: this.name })
: i18n.t('name.new.notification.registered', { name: this.name }),
});
this.$router.push({ name: 'name-list' });
} catch (e) {
if (e.message === 'Rejected by user') return;
this.error = true;
this.$store.dispatch('modals/open', {
name: 'notification',
text: i18n.t('name.new.notification.unknown-error', { name: this.name }),
});
handleUnknownError(e);
} finally {
this.$store.dispatch('names/fetchOwned');
this.busy = false;
}
},
},
Expand Down
2 changes: 0 additions & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import { pick } from 'lodash-es';
import Vue from 'vue';
import Vuex from 'vuex';
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/accounts/airGap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ['error', { 'ignorePropertyModificationsFor': ['state'] }] */

import { encode, Encoding } from '@aeternity/aepp-sdk-next';
import { getDesktopRemoteSignAction } from './utils';
import {
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/accounts/hdWallet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ['error', { 'ignorePropertyModificationsFor': ['state'] }] */

import { pick } from 'lodash-es';
import Vue from 'vue';
import { generateMnemonic, mnemonicToSeed } from '@aeternity/bip39';
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/accounts/hdWalletRemote.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ['error', { 'ignorePropertyModificationsFor': ['state'] }] */

import { getDesktopRemoteSignAction } from './utils';
import { i18n } from '../../plugins/ui/languages';

Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/accounts/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ['error', { 'ignorePropertyModificationsFor': ['state'] }] */

import airGap from './airGap';
import hdWallet from './hdWallet';
import hdWalletRemote from './hdWalletRemote';
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/accounts/ledger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import TransportWebUSB from '@ledgerhq/hw-transport-webusb';
import Ae from '@aeternity/ledger-app-api';
import { buildTx, decode, Tag } from '@aeternity/aepp-sdk-next';
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/desktop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

export default {
state: {
remoteConnected: false,
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/mobile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import Vue from 'vue';
import { i18n } from '../plugins/ui/languages';

Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/root.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import Vue from 'vue';
import { mergeWith } from 'lodash-es';
import networksRegistry from '../../lib/networksRegistry';
Expand Down
2 changes: 1 addition & 1 deletion src/store/plugins/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default (store) => {
networkId: '',
},
getters: {
node: (_, { currentNetwork }) => new Node(currentNetwork.url),
node: (_, { currentNetwork }) => new Node(currentNetwork.url, { retryCount: 0 }),
middleware: (_, { currentNetwork }) => new Middleware(currentNetwork.middlewareUrl),
sdk: (_, getters) => new AeSdkMethods({
onNode: getters.node,
Expand Down
2 changes: 0 additions & 2 deletions src/store/plugins/ui/appsMetadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import Vue from 'vue';
import { handleUnknownError } from '../../../lib/utils';
import { PROTOCOL_DEFAULT } from '../../../lib/constants';
Expand Down
2 changes: 0 additions & 2 deletions src/store/plugins/ui/currencies.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */

import { i18n } from './languages';

const currencies = {
Expand Down
3 changes: 0 additions & 3 deletions src/store/plugins/ui/languages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */
/* eslint-disable import/no-import-module-exports */

import Vue from 'vue';
import VueI18n from 'vue-i18n';
import en from '../../../locales/en.json';
Expand Down
1 change: 0 additions & 1 deletion src/store/plugins/ui/modals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */
const modals = {};

export const registerModal = ({
Expand Down
Loading

0 comments on commit cc46630

Please sign in to comment.