Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrades sdk dependency to 13.3.2 #1245

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 14.21.3
python 3.10.14
13,757 changes: 8,186 additions & 5,571 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
},
"license": "ISC",
"dependencies": {
"@aeternity/aepp-sdk": "^8.2.1",
"@aeternity/aepp-sdk": "^13.3.2",
"@fontsource/oxygen": "^4.4.5",
"@popperjs/core": "^2.9.2",
"@uvue/core": "^0.1.7",
"@uvue/server": "^0.1.7",
"aeternity-fungible-token": "git+https://git@github.com/aeternity/aeternity-fungible-token#v2.0.0",
"aeternity-fungible-token": "git+https://git@github.com/aeternity/aeternity-fungible-token#v2.2.0",
"animate.css": "^4.1.1",
"autosize": "^5.0.0",
"axios": "^0.21.1",
Expand All @@ -43,7 +43,6 @@
"fontsource-ibm-plex-sans": "^3.1.5",
"i18n": "^0.13.3",
"is-fqdn": "^2.0.1",
"jitsi-iframe-api": "^1.0.0",
kenodressel marked this conversation as resolved.
Show resolved Hide resolved
"lodash-es": "^4.17.21",
"lru-cache": "^6.0.0",
"node-fetch": "^2.6.1",
Expand All @@ -52,7 +51,7 @@
"smart-app-banner": "^2.0.0",
"sophia-bonding-curve": "git+https://git@github.com/aeternity/BondingCurve#1.0.0-alpha.2",
"soundcloud-widget": "^0.2.1",
"tipping-contract": "git+https://git@github.com/aeternity/tipping-contract#v5.0.0-alpha1",
"tipping-contract": "git+https://git@github.com/aeternity/tipping-contract#v5.0.0-alpha2",
"vue": "^2.6.14",
"vue-chartjs": "^3.5.1",
"vue-client-only": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export default {
}),
(async () => {
await this.$watchUntilTruly(() => this.sdk);
this.balance = await this.sdk.balance(this.address).catch((error) => {
this.balance = await this.sdk.getBalance(this.address).catch((error) => {
if (error.status !== 404) throw error;
kenodressel marked this conversation as resolved.
Show resolved Hide resolved
return 0;
});
Expand Down
52 changes: 6 additions & 46 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import Vue from 'vue';
import Vuex from 'vuex';
import BigNumber from 'bignumber.js';
import { genSwaggerClient } from '@aeternity/aepp-sdk';
import { mapObject } from '@aeternity/aepp-sdk/es/utils/other';
import { camelCase } from 'lodash-es';
import axios from 'axios';
import mutations from './mutations';
import getters from './getters';
import modals from './plugins/modals';
import backend from './modules/backend';
import aeternity from './modules/aeternity';
import Backend from '../utils/backend';
import { fetchJson } from '../utils';

Vue.use(Vuex);

Expand All @@ -30,7 +27,6 @@ export default () => new Vuex.Store({
wordRegistry: [],
isHiddenContent: true,
cookiesConsent: {},
middleware: null,
ssrTime: 'SH_SSR_TIME',
},
mutations,
Expand All @@ -45,14 +41,13 @@ export default () => new Vuex.Store({
dispatch('backend/callWithAuth', { method: 'getCookiesConsent' })
.then((list) => list.forEach(({ scope, status }) => commit('setCookiesConsent', { scope, status: status === 'ALLOWED' })));
},
async getTokenBalance({ state: { address, middleware } }, contractAddress) {
const result = await middleware.getAex9Balance(contractAddress, address);
return new BigNumber(result.amount || 0).toFixed();
async getTokenBalance({ state: { address } }, contractAddress) {
const result = await axios.get(`${process.env.VUE_APP_MIDDLEWARE_URL}/aex9/balance/${contractAddress}/${address}`);
return new BigNumber(result.data.amount || 0).toFixed();
},
async updateTokensBalanceAndPrice({ state: { address, middleware }, commit, dispatch }) {
async updateTokensBalanceAndPrice({ state: { address }, commit, dispatch }) {
const tokens = await Backend.getTokenBalances(address);
const knownTokens = (await Backend.getWordRegistry()).map((item) => item.tokenAddress);
if (!middleware) await dispatch('initMiddleware');
await Promise.all(Object.entries(tokens).map(async ([token]) => {
commit('addTokenBalance', {
token,
Expand All @@ -66,48 +61,13 @@ export default () => new Vuex.Store({
}
}));
},
async initMiddleware({ commit }) {
const specUrl = `${process.env.VUE_APP_MIDDLEWARE_URL}/swagger/swagger.json`;
const spec = await fetchJson(specUrl);

spec.paths = {
...spec.paths,
'aex9/balance/{token}/{account}?top=true': {
get: {
operationId: 'getAex9Balance',
parameters: [
{
in: 'path',
name: 'token',
required: true,
type: 'string',
},
{
in: 'path',
name: 'account',
required: true,
type: 'string',
},
],
},
},
};
spec.basePath = '/mdw//';
spec.schemes = ['https']; // TODO: Remove after solving https://github.com/aeternity/ae_mdw/issues/160

const middleware = mapObject(
(await genSwaggerClient(specUrl, { spec })).api,
([k, v]) => [camelCase(k), v],
);
commit('setMiddleware', middleware);
},
async fetchUserInfo({ dispatch, commit, state: { address, aeternity: { sdk } } }) {
if (!address) return;
await Promise.all([
dispatch('updatePinnedItems'),
dispatch('updateUserProfile'),
(async () => {
const balance = await sdk.balance(address).catch((error) => {
const balance = await sdk.getBalance(address).catch((error) => {
if (error.status !== 404) throw error;
kenodressel marked this conversation as resolved.
Show resolved Hide resolved
return 0;
});
Expand Down