Skip to content

Commit

Permalink
Release 1.0.0 (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelticot authored Dec 30, 2023
2 parents eb536fa + 0b303c6 commit 552cd0d
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 203 deletions.
23 changes: 23 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Verida vault context name. (Required)
VUE_APP_VAULT_CONTEXT_NAME=Verida: Vault

# Verida app context name. (Required)
VUE_APP_VERIDA_CONTEXT_NAME=Verida:Network Explorer

# Verida logo url to for the network config
VUE_APP_VERIDA_LOGO_URL=https://assets.verida.io/verida_login_request_logo_170x170.png

# Data source for sumary of nodes
VUE_APP_NODE_SUMMARY_URL=

# Data source for network stats
VUE_APP_NETWORK_STATUS_URL=

# Verida network being used, either 'mainnet' or 'testnet'
VUE_APP_VERIDA_ENV=testnet

# URL for the mainnet explorer
VUE_APP_EXPLORER_URL_MAINNET=

# URL for the testnet explorer
VUE_APP_EXPLORER_URL_TESTNET=
14 changes: 0 additions & 14 deletions .env.sample

This file was deleted.

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ coverage


# local env files
.env.local
.env.*.local
.env
.env*
!.env.example

# Log files
npm-debug.log*
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.2.25",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --mode sample",
"build": "vue-cli-service build --mode sample",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"format:check": "npx prettier src/ --check",
Expand All @@ -14,11 +14,11 @@
"acorn": "8.0.1"
},
"dependencies": {
"@verida/account-web-vault": "^2.3.5",
"@verida/client-ts": "^2.3.5",
"@verida/helpers": "^2.3.1",
"@verida/types": "^2.3.1",
"@verida/verifiable-credentials": "^2.3.5",
"@verida/account-web-vault": "^3.0.1",
"@verida/client-ts": "^3.0.1",
"@verida/helpers": "^3.0.1",
"@verida/types": "^3.0.0",
"@verida/verifiable-credentials": "^3.0.1",
"@verida/vue-account": "^0.1.38",
"@verida/vue-credentials-view": "^0.1.3",
"buffer": "^6.0.3",
Expand Down
8 changes: 8 additions & 0 deletions src/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<a href="/#nodestats">
<span class="menuitem">Node Statistics</span>
</a>
<a :href="changeNetworkLink">
<span class="menuitem">Switch to {{ changeNetwork }}</span>
</a>
</span>

<!-- <vda-account
Expand All @@ -39,6 +42,11 @@ export default defineComponent({
loading: false,
contextName: config.veridaContextName,
logo: config.veridaLogoUrl,
changeNetwork: config.veridaEnv == "mainnet" ? "Testnet" : "Mainnet",
changeNetworkLink:
config.veridaExplorerUrls[
config.veridaEnv == "mainnet" ? "testnet" : "mainnet"
],
}),
components: {},
computed: {
Expand Down
5 changes: 4 additions & 1 deletion src/components/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import { defineComponent } from "vue";
import { mapActions, mapState, mapMutations } from "vuex";
import { useField, useForm } from "vee-validate";
import { config } from '@/config'
import * as yup from "yup";
export default defineComponent({
Expand All @@ -55,10 +56,12 @@ export default defineComponent({
...mapState(["profile", "error", "loader"]),
},
setup() {
const environment = config.veridaEnv;
console.log(environment)
const schema = yup.object({
did: yup
.string()
.matches(/^did:vda:testnet:.+$/)
.matches(new RegExp(`^did:vda:${environment}:.+$`))
.trim()
.required()
.min(58)
Expand Down
22 changes: 16 additions & 6 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@ import { EnvironmentType } from "@verida/types";

const nodeEnv = process.env.NODE_ENV || "development";

const veridaEnv: EnvironmentType =
process.env.VUE_APP_VERIDA_ENV === "local"
? EnvironmentType.LOCAL
: process.env.VUE_APP_VERIDA_ENV === "mainnet"
? EnvironmentType.MAINNET
: EnvironmentType.TESTNET;
console.log(process.env.VUE_APP_VERIDA_ENV);

const veridaEnv: EnvironmentType = <EnvironmentType>(
process.env.VUE_APP_VERIDA_ENV
);

const veridaLogoUrl = process.env.VUE_APP_VERIDA_LOGO_URL;
const veridaLoginText = process.env.VUE_APP_VERIDA_LOGO_URL;
const veridaContextName = process.env.VUE_APP_VERIDA_CONTEXT_NAME;
const veridaVaultContextName = process.env.VUE_APP_VERIDA_VAULT_CONTEXT_NAME;
const veridaNodeSummaryUrl = process.env.VUE_APP_NODE_SUMMARY_URL;
const veridaNetworkStatusUrl = process.env.VUE_APP_NETWORK_STATUS_URL;
const veridaTestnetDefaultDidServerUrl =
process.env.VUE_APP_VERIDA_TESTNET_DEFAULT_DID_SERVER;
const veridaExplorerUrls = {
mainnet: process.env.VUE_APP_EXPLORER_URL_MAINNET,
testnet: process.env.VUE_APP_EXPLORER_URL_TESTNET,
};

console.log(veridaExplorerUrls);

export const config = {
nodeEnv,
Expand All @@ -24,4 +31,7 @@ export const config = {
veridaContextName,
veridaVaultContextName,
veridaTestnetDefaultDidServerUrl,
veridaNodeSummaryUrl,
veridaNetworkStatusUrl,
veridaExplorerUrls,
};
9 changes: 4 additions & 5 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import { groupBy } from "lodash";
import { defineComponent, reactive } from "vue";
import VueTableLite from "vue3-table-lite/ts";
import { mapState } from "vuex";
import { config } from "@/config";
type RawDataRow = { datetime_utc: string; activedids: string };
type RawData = RawDataRow[];
Expand Down Expand Up @@ -168,9 +169,9 @@ export default defineComponent({
sort: string
) => {
table.isLoading = true;
const url = `https://assets.verida.io/metrics/nodes/testnet-nodes-summary.json`;
const url = config.veridaNodeSummaryUrl;
json(url).then((data) => {
json(url!).then((data) => {
const nodeSummary: NodeSummaryData[] = data as NodeSummaryData[];
const rows: NodeSummaryAsFields[] = [];
Expand Down Expand Up @@ -428,9 +429,7 @@ export default defineComponent({
// Request data using D3
const cachebreak = new Date().getTime();
csv(
`https://assets.verida.io/metrics/network/testnet/stats.csv?cb=${cachebreak}`
).then((value) => {
csv(`${config.veridaNetworkStatusUrl}?cb=${cachebreak}`).then((value) => {
// d3 is poorly typed and doesn't allow overriding the generic type for the returned data. It is forced as 'string' while it's clearly an object, so have to cast it.
// A better option would be to validate the data with Zod and infer the type from it.
this.handleStatsData(value as unknown as RawData);
Expand Down
Loading

0 comments on commit 552cd0d

Please sign in to comment.