Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/components/ContractTab/FunctionInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable max-len -->
<script lang="ts">
import { defineComponent, toRaw } from 'vue';
import { defineComponent } from 'vue';
import { mapGetters } from 'vuex';
import { BigNumber, ethers } from 'ethers';
import { Transaction } from '@ethereumjs/tx';
Expand Down Expand Up @@ -243,7 +243,12 @@ export default defineComponent({
);
},
async runNative(opts: Opts) {
const contractInstance = toRaw(await this.contract.getContractInstance());
const contractInstance = await useChainStore().currentChain.settings.getContractManager().getContractInstance(this.contract, null);
if (!contractInstance) {
this.errorMessage = this.$t('global.internal_error');
this.endLoading();
return;
}
const func = contractInstance.populateTransaction[this.functionABI];
const gasEstimater = contractInstance.estimateGas[this.functionABI];
const gasLimit = await gasEstimater(...this.models.values, Object.assign({ from: this.address }, opts));
Expand All @@ -263,7 +268,7 @@ export default defineComponent({
unsignedTrx.gasPrice = gasPrice;

if (opts.value) {
unsignedTrx.value = opts.value;
unsignedTrx.value = BigNumber.from(opts.value);
}

const raw = ethers.utils.serializeTransaction(unsignedTrx);
Expand Down
2 changes: 2 additions & 0 deletions src/components/header/AppHeaderWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useAccountStore, useChainStore } from 'src/core';
import { WEI_PRECISION } from 'src/core/wallets/utils';
import { prettyPrintCurrency } from 'src/core/wallets/utils/currency-utils';


import LoginModal from 'components/LoginModal.vue';
import OutlineButton from 'components/OutlineButton.vue';

Expand Down Expand Up @@ -82,6 +83,7 @@ function handleWalletButtonClick() {
}

function logout() {
$store.dispatch('login/logout');
useAccountStore().logout();
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/chains/telos-evm-testnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const config: NetworkConfig =
'rpcEndpoints': [
{
'protocol': 'https',
'host': 'rpc.testnet.telos.net',
'host': 'testnet.telos.net',
'port': 443,
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/config/chains/telos-evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const config: NetworkConfig =
'rpcEndpoints': [
{
'protocol': 'https',
'host': 'rpc.telos.net',
'host': 'mainnet.telos.net',
'port': 443,
},
],
Expand Down
12 changes: 9 additions & 3 deletions src/store/login/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useChainStore } from 'src/core';
import { LOGIN_DATA_KEY } from 'src/lib/utils';

export const login = async function(
{ commit, dispatch },
Expand Down Expand Up @@ -56,24 +57,29 @@ export const autoLogin = async function({ dispatch, commit }, returnUrl) {
const getAuthenticator = function(ual, wallet = null) {
const authWallet = wallet || localStorage.getItem('autoLogin');
const idx = ual.authenticators.findIndex(
auth => auth.constructor.name === authWallet,
auth => auth.constructor.name.toLowerCase() === authWallet.toLowerCase(),
);
return {
authenticator: ual.authenticators[idx],
idx,
};
};

export const logout = async function({ getters }) {
export const logout = async function({ getters, commit }) {
if (getters.isNative) {
const { authenticator } = getAuthenticator(useChainStore().currentChain.settings.getUAL());
const loginData = JSON.parse(localStorage.getItem(LOGIN_DATA_KEY));
const { authenticator } = getAuthenticator(useChainStore().currentChain.settings.getUAL(), loginData.provider);
try {
authenticator && (await authenticator.logout());
} catch (error) {
console.error('Authenticator logout error', error);
}

commit('setLogin', {});
localStorage.removeItem(LOGIN_DATA_KEY);
localStorage.removeItem('autoLogin');
localStorage.removeItem('account');
localStorage.removeItem('returning');

if (this.$router.currentRoute.path !== '/') {
this.$router.push({ path: '/' });
Expand Down