Skip to content

Commit b6277aa

Browse files
authored
Merge pull request #1581 from aeternity/update-sdk-14
chore: use next sdk everywhere except aepps connection
2 parents b4f5f1c + 602e273 commit b6277aa

File tree

23 files changed

+135
-80
lines changed

23 files changed

+135
-80
lines changed

src/components/ConnectionStatus.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ export default {
1515
computed: mapState({
1616
message({ onLine, sdk }) {
1717
if (!onLine) return { text: this.$t('network.connection-status.offline') };
18-
if (!sdk) return { text: this.$t('network.connection-status.no-sdk') };
19-
if (sdk.then)
20-
return { text: this.$t('network.connection-status.connecting'), className: 'connecting' };
18+
const { networkId } = this.$store.state.sdkSync;
19+
switch (networkId) {
20+
case '_cant-connect':
21+
return { text: this.$t('network.connection-status.cant-connect') };
22+
case '_connecting':
23+
return { text: this.$t('network.connection-status.connecting'), className: 'connecting' };
24+
}
2125
if (!this.middlewareStatus) {
2226
return {
2327
text: this.$t('network.connection-status.middleware.unavailable'),
@@ -32,7 +36,7 @@ export default {
3236
className: 'connecting',
3337
};
3438
}
35-
if (process.env.NODE_ENV === 'production' && sdk.getNetworkId() !== 'ae_mainnet') {
39+
if (process.env.NODE_ENV === 'production' && networkId !== 'ae_mainnet') {
3640
return {
3741
text: this.$t('network.connection-status.connected-to-testnet'),
3842
className: 'test-net',

src/locales/cn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
"network": {
557557
"connection-status": {
558558
"offline": "您已离线,请检查您的网络连接。",
559-
"no-sdk": "我们无法连接到您选择的节点。",
559+
"cant-connect": "我们无法连接到您选择的节点。",
560560
"connecting": "正在连接网络中...",
561561
"connected-to-testnet": "您已连接到测试网。",
562562
"middleware": {

src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
"network": {
557557
"connection-status": {
558558
"offline": "You are offline... Please check your connection.",
559-
"no-sdk": "We are unable to connect to the chosen node.",
559+
"cant-connect": "We are unable to connect to the chosen node.",
560560
"connecting": "Connecting to the network...",
561561
"connected-to-testnet": "You are connected to a testnet.",
562562
"middleware": {

src/locales/es.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
"network": {
557557
"connection-status": {
558558
"offline": "Estás desconectado... Comprueba tu conexión",
559-
"no-sdk": "No podemos conectarnos al nodo elegido",
559+
"cant-connect": "No podemos conectarnos al nodo elegido",
560560
"connecting": "Conectando a la red...",
561561
"connected-to-testnet": "Está conectado a una red de prueba",
562562
"middleware": {

src/locales/ru.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
"network": {
557557
"connection-status": {
558558
"offline": "Вы не в сети... Пожалуйста, проверьте ваше подключение к интернету.",
559-
"no-sdk": "Мы не можем подключиться к выбранному узлу.",
559+
"cant-connect": "Мы не можем подключиться к выбранному узлу.",
560560
"connecting": "Подключаемся к сети...",
561561
"connected-to-testnet": "Вы подключены к тестовой сети.",
562562
"middleware": {

src/pages/aens/AuctionBid.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import { pick, debounce } from 'lodash-es';
7676
import BigNumber from 'bignumber.js';
7777
import { mapGetters } from 'vuex';
78+
import { Name } from '@aeternity/aepp-sdk-next';
7879
import { MAGNITUDE } from '../../lib/constants';
7980
import blocksToRelativeTime from '../../filters/blocksToRelativeTime';
8081
import Page from '../../components/Page.vue';
@@ -144,7 +145,9 @@ export default {
144145
}
145146
this.busy = true;
146147
try {
147-
await this.$store.state.sdk.aensBid(name, BigNumber(this.amount).shiftedBy(MAGNITUDE));
148+
await new Name(name, this.$store.getters.sdk.getContext()).bid(
149+
BigNumber(this.amount).shiftedBy(MAGNITUDE),
150+
);
148151
this.$store.dispatch('modals/open', {
149152
name: 'notification',
150153
text: i18n.t('name.new.notification.bid', { name }),

src/pages/aens/NameList.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ export default {
6161
NamePending,
6262
ButtonAddFixed,
6363
},
64-
data: () => ({
65-
auctions: [],
66-
height: null,
67-
}),
64+
data: () => ({ auctions: [] }),
6865
computed: mapState('names', ['owned']),
6966
async mounted() {
7067
const fetchNames = () => this.$store.dispatch('names/fetchOwned');
@@ -90,17 +87,17 @@ export default {
9087
}),
9188
),
9289
);
93-
this.height ??= await this.$store.state.sdk.height();
90+
const height = await this.$store.getters.sdk.getHeight({ cached: true });
9491
const recentlyClaimedNames = uniq(
9592
claims
9693
.map(({ data }) => data)
9794
.flat()
9895
// max auction length is 29760 blocks, but it can be increased multiple times by 120
99-
.filter(({ blockHeight }) => blockHeight > this.height - 40000)
96+
.filter(({ blockHeight }) => blockHeight > height - 40000)
10097
.map(({ tx: { name } }) => name.toLowerCase())
10198
.filter((name) => isNameValid(name) && isAuctionName(name)),
10299
);
103-
const nodeNoRetry = new Node(this.$store.state.sdkUrl, { retryCount: 0 });
100+
const nodeNoRetry = new Node(this.$store.getters.node.$host, { retryCount: 0 });
104101
this.auctions = (
105102
await Promise.allSettled(
106103
recentlyClaimedNames.map((name) =>

src/pages/aens/NameNew.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
<script>
4141
import { mapGetters } from 'vuex';
42+
import { Name } from '@aeternity/aepp-sdk-next';
4243
import { MAX_AUCTION_NAME_LENGTH } from '../../lib/constants';
4344
import { handleUnknownError, isNotFoundError } from '../../lib/utils';
4445
import { i18n } from '../../store/plugins/ui/languages';
@@ -62,7 +63,6 @@ export default {
6263
async handleSubmit() {
6364
if (!(await this.$validator.validateAll())) return;
6465
this.busy = true;
65-
let claimTxHash;
6666
6767
try {
6868
await this.$store.getters.node.getAuctionEntryByName(this.name);
@@ -82,11 +82,11 @@ export default {
8282
}
8383
}
8484
85+
const name = new Name(this.name, this.$store.getters.sdk.getContext());
86+
let claimTxHash;
8587
try {
86-
const { salt } = await this.$store.state.sdk.aensPreclaim(this.name);
87-
claimTxHash = (await this.$store.state.sdk.aensClaim(this.name, salt, { waitMined: false }))
88-
.hash;
89-
88+
await name.preclaim();
89+
claimTxHash = (await name.claim({ waitMined: false })).hash;
9090
this.$store.dispatch('modals/open', {
9191
name: 'notification',
9292
text: this.$t('name.new.notification.claim-sent', { name: this.name }),
@@ -102,7 +102,7 @@ export default {
102102
103103
try {
104104
this.$store.dispatch('names/fetchOwned');
105-
await this.$store.state.sdk.poll(claimTxHash);
105+
await this.$store.getters.sdk.poll(claimTxHash);
106106
const isAuction = MAX_AUCTION_NAME_LENGTH >= this.name.length;
107107
if (!isAuction) {
108108
await this.$store.dispatch('names/updatePointer', {

src/pages/aens/NameTransfer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<script>
5252
import { mapState, mapGetters } from 'vuex';
5353
import { defer } from 'lodash-es';
54+
import { Name } from '@aeternity/aepp-sdk-next';
5455
import { handleUnknownError, getAddressByNameEntry } from '../../lib/utils';
5556
import Page from '../../components/Page.vue';
5657
import Guide from '../../components/Guide.vue';
@@ -149,8 +150,7 @@ export default {
149150
address: this.accountTo,
150151
});
151152
} else {
152-
if (this.$store.state.sdk.then) await this.$store.state.sdk;
153-
await this.$store.state.sdk.aensTransfer(this.nameEntry.name, this.accountTo);
153+
await new Name(this.name, this.$store.getters.sdk.getContext()).transfer(this.accountTo);
154154
}
155155
this.$store.dispatch('modals/open', {
156156
name: 'notification',

src/pages/desktop/Send.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default {
100100
const amount = BigNumber(this.amount);
101101
this.busy = true;
102102
try {
103-
const { hash } = await this.$store.state.sdk.spend(
103+
const { hash } = await this.$store.getters.sdk.spend(
104104
amount.shiftedBy(MAGNITUDE),
105105
this.accountTo,
106106
);

0 commit comments

Comments
 (0)