Skip to content

Commit

Permalink
Merge pull request #483 from telosnetwork/dev
Browse files Browse the repository at this point in the history
v1.4.8-rc
  • Loading branch information
donnyquixotic authored Nov 30, 2023
2 parents b2ae1c1 + 3c30995 commit f5d1e31
Show file tree
Hide file tree
Showing 37 changed files with 6,926 additions and 590 deletions.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
publish = "dist/spa"

[context.environment]
NODE_VERSION = "14"
NODE_VERSION = "16"

[[redirects]]
from = "/*"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "teloscan",
"version": "1.4.6",
"version": "1.4.8",
"description": "Teloscan block explorer",
"productName": "Teloscan",
"author": "Jesse Schulman <jesse@caleos.io>",
Expand All @@ -21,7 +21,7 @@
"@wagmi/core": "^1.3.7",
"@web3modal/ethereum": "2.7.0",
"@web3modal/html": "2.7.0",
"axios": "^0.21.2",
"axios": "^1.6.0",
"axios-time": "^1.0.0",
"babel-loader": "^8.1.0",
"big.js": "^6.2.1",
Expand All @@ -41,6 +41,7 @@
"oreid-js": "^4.7.1",
"oreid-webpopup": "^2.4.0",
"quasar": "2",
"rxjs": "^7.8.0",
"ual-anchor": "^1.0.0",
"ual-ledger": "^0.3.0",
"ual-wombat": "^0.3.3",
Expand Down
File renamed without changes
Binary file added public/branding/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/favicon.ico
Binary file not shown.
Binary file added public/branding/stlos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,262 changes: 6,262 additions & 0 deletions public/branding/telos-bridge-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-circle-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
10 changes: 5 additions & 5 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,27 @@ module.exports = function(/* ctx */) {
theme_color: '#027be3',
icons: [
{
src: 'icons/icon-128x128.png',
src: 'branding/telos-scan.png',
sizes: '128x128',
type: 'image/png',
},
{
src: 'icons/icon-192x192.png',
src: 'branding/telos-scan.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'icons/icon-256x256.png',
src: 'branding/telos-scan.png',
sizes: '256x256',
type: 'image/png',
},
{
src: 'icons/icon-384x384.png',
src: 'branding/telos-scan.png',
sizes: '384x384',
type: 'image/png',
},
{
src: 'icons/icon-512x512.png',
src: 'branding/telos-scan.png',
sizes: '512x512',
type: 'image/png',
},
Expand Down
29 changes: 26 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
<script>
export default {
<script lang="ts">
import { getAntelope } from 'src/antelope';
import { defineComponent } from 'vue';
export const isTodayBeforeTelosCloudDown = new Date().getTime() < new Date('2023-12-31').getTime();
export default defineComponent({
name: 'App',
};
mounted() {
if (isTodayBeforeTelosCloudDown) {
getAntelope().config.notifyRememberInfoHandler(
this.$t('temporal.telos_cloud_discontinued_title'),
[{
tag: 'p',
class: 'c-notify__message--subtitle',
text: this.$t('temporal.telos_cloud_discontinued_message_title'),
}, {
tag: 'p',
class: '',
text: this.$t('temporal.telos_cloud_discontinued_message_body'),
}],
'',
'telos-cloud-discontinued',
);
}
},
});
</script>
<template>
<div id="q-app">
Expand Down
3 changes: 3 additions & 0 deletions src/antelope/mocks/AccountStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class AccountStore {
async loginEVM({ authenticator, network }: LoginEVMActionData): Promise<boolean> {
currentAuthenticator = authenticator;
currentAccount = await authenticator.login(network);
const account = useAccountStore().getAccount(authenticator.label);
getAntelope().events.onLoggedIn.next(account);
return true;
}

Expand All @@ -62,6 +64,7 @@ class AccountStore {
currentAuthenticator.logout();
currentAuthenticator = {} as EVMAuthenticator;
currentAccount = null;
getAntelope().events.onLoggedOut.next();
}

get loggedAccount() {
Expand Down
28 changes: 28 additions & 0 deletions src/antelope/mocks/AntelopeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { EVMAuthenticator } from 'src/antelope/wallets/authenticators/EVMAuthent
import { AntelopeError, AntelopeErrorPayload } from 'src/antelope/types';
import { App } from 'vue';
import { Authenticator } from 'universal-authenticator-library';
import { Subject } from 'rxjs';
import { AccountModel } from 'src/antelope/mocks/AccountStore';

export interface ComplexMessage {
tag: string,
class: string,
text: string,
}

export class AntelopeWallets {
private authenticators: Map<string, EVMAuthenticator> = new Map();
Expand Down Expand Up @@ -52,6 +60,8 @@ export class AntelopeConfig {
private __notify_failure_action_handler: (message: string, payload?: AntelopeErrorPayload) => void = alert;
private __notify_disconnected_handler: () => void = alert;
private __notify_neutral_message_handler: (message: string) => (() => void) = () => (() => void 0);
private __notify_remember_info_handler: (title: string, message: string | ComplexMessage[],
payload: string, key: string) => (() => void) = () => (() => void 0);

// ual authenticators list getter --
private __authenticators_getter: () => Authenticator[] = () => [];
Expand Down Expand Up @@ -175,6 +185,10 @@ export class AntelopeConfig {
return this.__notify_neutral_message_handler;
}

get notifyRememberInfoHandler() {
return this.__notify_remember_info_handler;
}

get authenticatorsGetter() {
return this.__authenticators_getter;
}
Expand Down Expand Up @@ -241,6 +255,15 @@ export class AntelopeConfig {
this.__notify_neutral_message_handler = handler;
}

public setNotifyRememberInfoHandler(handler: (
title: string,
message: string | ComplexMessage[],
payload: string,
key: string,
) => (() => void)) {
this.__notify_remember_info_handler = handler;
}

// setting authenticators getter --
public setAuthenticatorsGetter(getter: () => Authenticator[]) {
this.__authenticators_getter = getter;
Expand All @@ -265,9 +288,14 @@ export class AntelopeConfig {

const config = new AntelopeConfig();
const wallets = new AntelopeWallets();
const events = {
onLoggedIn: new Subject<AccountModel>(),
onLoggedOut: new Subject<void>(),
};
const Antelope = {
config,
wallets,
events,
};

export const getAntelope = () => Antelope;
Expand Down
2 changes: 2 additions & 0 deletions src/antelope/wallets/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function initAntelope(app: App) {
ant.config.setNotifyFailureWithAction(app.config.globalProperties.$notifyFailureWithAction);
ant.config.setNotifyDisconnectedHandler(app.config.globalProperties.$notifyDisconnected);
ant.config.setNotifyNeutralMessageHandler(app.config.globalProperties.$notifyNeutralMessage);
ant.config.setNotifyRememberInfoHandler(app.config.globalProperties.$notifyRememberInfo);


// setting authenticators getter --
Expand Down Expand Up @@ -87,3 +88,4 @@ export function initAntelope(app: App) {
ant.wallets.addEVMAuthenticator(new BraveAuth());

}

3 changes: 3 additions & 0 deletions src/assets/icon--info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 53 additions & 5 deletions src/boot/errorHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class NotificationAction {
}

const crossIcon = require('src/assets/icon--cross.svg');
const infoIcon = require('src/assets/icon--info.svg');
const checkIcon = require('src/assets/icon--check.svg');
const discoIcon = require('src/assets/icon--disconnected.svg');

Expand All @@ -76,13 +77,16 @@ const html = `
<span>{title}</span>
</div>
<div class="c-notify__message">
<span>{message}</span>
{message}
</div>
<div class="c-notify__checkbox-container c-notify__checkbox--{remember}">
<input type="checkbox" id="c-notify__checkbox--{remember}" class="c-notify__checkbox" />
<label for="c-notify__checkbox--{remember}" class="c-notify__label">{remember-my-choice}</label>
</div>
</div>
`;

const notifyMessage = function(type, icon, title, message, payload) {

const notifyMessage = function(type, icon, title, message, payload, remember = '') {
// action buttons
const actions = [];
const dismiss_btn = {
Expand Down Expand Up @@ -154,15 +158,15 @@ const notifyMessage = function(type, icon, title, message, payload) {
actions.splice(0, actions.length);
}

let final_message = this.$t(message ?? '');
let final_message = '<span>' + this.$t(message.toString() ?? '') + '</span>';
if (Array.isArray(message)) {
final_message = message.map(
m => ` <${m.tag ?? 'span'} class="${m.class}">${m.text}</${m.tag ?? 'span'}> `,
).join('');
}

let timeout = 4000;
if (type === 'error') {
if (type === 'error' || type === 'info') {
timeout = 0;
}

Expand All @@ -188,7 +192,9 @@ const notifyMessage = function(type, icon, title, message, payload) {
'{type}': type,
'{title}': title,
'{random}': random,
'{remember}': remember,
'{message}': final_message,
'{remember-my-choice}': this.$t('notification.dont_show_message_again'),
};

const finalHtml = replaceAllOccurrences(html, replacements);
Expand Down Expand Up @@ -270,6 +276,46 @@ const notifyNeutralMessage = function(message) {
);
};

const notifyRememberInfo = function(title, message, payload, key) {
const id = `c-notify__checkbox--${key}`;
const storageKey = 'c-notify--dismissed-messages';
const dismissed = JSON.parse(localStorage.getItem(storageKey)) ?? {};
if (dismissed[id]) {
return;
}
const notification = notifyMessage.bind(this)(
'info',
infoIcon,
title,
message,
payload,
key,
);

const handler = (event) => {
// If the user click the checkbox, we set the flag in the local storage
if (event.target.id === id) {
const checkbox = document.getElementById(id);
if (checkbox.checked) {
dismissed[id] = true;
} else {
delete dismissed[id];
}
localStorage.setItem(storageKey, JSON.stringify(dismissed));
} else {
// catching Dismiss button click
if (event.target.parentNode.classList.contains('q-btn__content')) {
window.removeEventListener('click', handler);
}
}
};

window.addEventListener('click', handler);
return notification;
};



export default boot(({ app, store }) => {
app.config.globalProperties.$errorNotification = errorNotification.bind(store);
app.config.globalProperties.$unexpectedErrorNotification = unexpectedErrorNotification.bind(store);
Expand All @@ -288,13 +334,15 @@ export default boot(({ app, store }) => {
app.config.globalProperties.$notifyFailureWithAction = notifyFailureWithAction.bind(store);
app.config.globalProperties.$notifyDisconnected = notifyDisconnected.bind(store);
app.config.globalProperties.$notifyNeutralMessage = notifyNeutralMessage.bind(store);
app.config.globalProperties.$notifyRememberInfo = notifyRememberInfo.bind(store);
store['$notifySuccessTransaction'] = app.config.globalProperties.$notifySuccessTransaction;
store['$notifySuccessMessage'] = app.config.globalProperties.$notifySuccessMessage;
store['$notifySuccessCopy'] = app.config.globalProperties.$notifySuccessCopy;
store['$notifyFailure'] = app.config.globalProperties.$notifyFailure;
store['$notifyFailureWithAction'] = app.config.globalProperties.$notifyFailureWithAction;
store['$notifyDisconnected'] = app.config.globalProperties.$notifyDisconnected;
store['$notifyNeutralMessage'] = app.config.globalProperties.$notifyNeutralMessage;
store['$notifyRememberInfo'] = app.config.globalProperties.$notifyRememberInfo;

// transaction notifications handlers
store['$t'] = app.config.globalProperties.$t;
Expand Down
10 changes: 6 additions & 4 deletions src/components/ContractTab/FunctionInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,23 @@ export default defineComponent({
this.loading = true;
this.result = null;
try {

if (this.abi.stateMutability === 'view') {
return await this.runRead();
}

const loginData = localStorage.getItem(LOGIN_DATA_KEY);
if (!loginData) {
console.error('No login data found');
this.errorMessage = this.$t('global.internal_error');
return;
}

const opts: Opts = {};
if (this.abi.stateMutability === 'payable') {
opts.value = this.value;
}

if (this.abi.stateMutability === 'view') {
return await this.runRead();
}

if (this.isNative) {
return await this.runNative(opts);
}
Expand Down
17 changes: 14 additions & 3 deletions src/components/ContractTab/GenericContractInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import JsonViewer from 'vue-json-viewer';
import Contract from 'src/lib/Contract';
import { erc721Abi } from 'src/lib/abi';
import { erc721Abi, erc1155Abi } from 'src/lib/abi';
import erc20Abi from 'erc-20-abi';
import { sortAbiFunctionsByName } from 'src/lib/utils';
Expand All @@ -26,6 +26,7 @@ export default {
abiOptions: {
erc20: 'erc20',
erc721: 'erc721',
erc1155: 'erc1155',
custom: 'custom',
},
}),
Expand Down Expand Up @@ -104,7 +105,7 @@ export default {
write: [],
};
const { custom, erc20, erc721 } = this.abiOptions;
const { custom, erc20, erc721, erc1155 } = this.abiOptions;
let abi;
const customAbiSelected = this.selectedAbi === custom;
Expand All @@ -119,7 +120,9 @@ export default {
abi = erc20Abi;
} else if (this.selectedAbi === erc721) {
abi = erc721Abi;
} else {
} else if (this.selectedAbi === erc1155) {
abi = erc1155Abi;
}else{
return;
}
if (!Array.isArray(abi)) {
Expand Down Expand Up @@ -201,6 +204,14 @@ export default {
>
{{ $t('components.contract_tab.use_erc721_abi') }}
</q-btn>
<q-btn
push
no-caps
:outline="selectedAbi === abiOptions.erc1155"
@click="selectedAbi = abiOptions.erc1155"
>
{{ $t('components.contract_tab.use_erc1155_abi') }}
</q-btn>
<q-btn
push
no-caps
Expand Down
Loading

0 comments on commit f5d1e31

Please sign in to comment.