Skip to content

Commit

Permalink
Only show hardcoded paratimes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed May 9, 2022
1 parent 21eea73 commit 6389c47
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/background/api/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as oasis from "@oasisprotocol/client";
import { cointypes, TX_LIST_LENGTH } from "../../../config";
import { amountDecimals, isNumber } from "../../utils/utils";
import { amountDecimals, getRuntimeConfig, isNumber } from "../../utils/utils";
import { commonFetch, getOasisClient } from "./request";
import { getRpcAccount } from "./rpc";
import * as oasisRT from "@oasisprotocol/client-rt";
Expand Down Expand Up @@ -186,6 +186,8 @@ export async function getRpcRuntimeList() {
const runtime = runtimeList[index];
let id = runtime.id;
let runtimeId = oasis.misc.toHex(id);
let runtimeConfig = getRuntimeConfig(runtimeId);
if (!runtimeConfig) continue; // Only keep runtimes from PARATIME_CONFIG
list.push({
name: "unknown",
runtimeId: runtimeId,
Expand Down
1 change: 1 addition & 0 deletions src/reducers/accountReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const setRuntimeName=(currentAccount,runtimeList)=>{
for (let index = 0; index < runtimeList.length; index++) {
let runtime = runtimeList[index];
let runtimeConfig = getRuntimeConfig(runtime.runtimeId)
if (!runtimeConfig) continue // Only keep runtimes from PARATIME_CONFIG
let isEmerald = runtimeConfig.accountType === RUNTIME_ACCOUNT_TYPE.EVM
let config = {
...runtime,
Expand Down
5 changes: 1 addition & 4 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,16 @@ export async function getEvmBech32Address(evmAddress){
* @returns
*/
export function getRuntimeConfig(runtimeId){
let runtimeConfig = {}
for (let index = 0; index < PARATIME_CONFIG.length; index++) {
const runtime = PARATIME_CONFIG[index];
let runtimeIdList = runtime.runtimeIdList
for (let j = 0; j < runtimeIdList.length; j++) {
let config = runtimeIdList[j]
if(runtimeId === config.runtimeId){
runtimeConfig = runtime
return runtimeConfig
return runtime
}
}
}
return runtimeConfig
}

/**
Expand Down

0 comments on commit 6389c47

Please sign in to comment.