Skip to content

Commit

Permalink
Merge pull request #470 from enkryptcom/devop/prep-release
Browse files Browse the repository at this point in the history
devop: prep release
  • Loading branch information
kvhnuke authored Jul 30, 2024
2 parents f399b64 + 8415a63 commit 8c76488
Show file tree
Hide file tree
Showing 29 changed files with 424 additions and 107 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"ultra-runner": "^3.10.5"
},
"resolutions": {
"@ledgerhq/compressjs": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.2.1.tgz"
"@ledgerhq/compressjs": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.2.1.tgz",
"@noble/hashes": "^1.4.0"
}
}
5 changes: 4 additions & 1 deletion packages/extension-bridge/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export const getBackgroundPageType = (): RuntimeContext => {
const url = new URL(browser.runtime.getURL(manifest.options_ui.page));
if (url.pathname === window.location.pathname) return "options";
}
if (window?.location?.pathname === "/index.html") {
if (
window?.location?.pathname === "/index.html" ||
window?.location?.pathname === "/onboard.html"
) {
return "new-window";
}
return "background";
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.41.0",
"version": "1.42.0",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand Down
10 changes: 6 additions & 4 deletions packages/extension/src/providers/common/libs/new-features.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { NetworkNames } from "@enkryptcom/types";

const newNetworks = [
NetworkNames.Kadena,
NetworkNames.Rollux,
NetworkNames.Syscoin,
NetworkNames.Telos,
NetworkNames.Blast,
NetworkNames.Sanko,
NetworkNames.Degen,
NetworkNames.Ham,
];
const newSwaps = [NetworkNames.MaticZK, NetworkNames.Base];
const newSwaps: NetworkNames[] = [];

export { newNetworks, newSwaps };
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import EtherscanActivity from "./providers/etherscan";
import OkcActivity from "./providers/okc";
import TomoScan from "./providers/tomoscan";
import OntEVMActivity from "./providers/ont-evm";
import TelosActivity from "./providers/telos";
export {
RivetActivity,
EtherscanActivity,
OkcActivity,
OntEVMActivity,
TomoScan,
TelosActivity,
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NetworkNames } from "@enkryptcom/types";

const NetworkEndpoints: Record<string, string> = {
[NetworkNames.Ethereum]: "https://api.etherscan.io/",
[NetworkNames.Ethereum]: "https://eth.blockscout.com/",
[NetworkNames.Binance]: "https://api.bscscan.com/",
[NetworkNames.Matic]: "https://api.polygonscan.com/",
[NetworkNames.Matic]: "https://polygon.blockscout.com/",
[NetworkNames.Moonbeam]: "https://api-moonbeam.moonscan.io/",
[NetworkNames.Moonriver]: "https://api-moonriver.moonscan.io/",
[NetworkNames.KaruraEVM]: "https://blockscout.karura.network/",
Expand All @@ -13,6 +13,7 @@ const NetworkEndpoints: Record<string, string> = {
[NetworkNames.Canto]: "https://evm.explorer.canto.io/",
[NetworkNames.EdgeEVM]: "https://edgscan.live/",
[NetworkNames.Rootstock]: "https://blockscout.com/rsk/mainnet/",
[NetworkNames.RootstockTestnet]: "https://rootstock-testnet.blockscout.com/",
[NetworkNames.SkaleBlockBrawlers]:
"https://frayed-decent-antares.explorer.mainnet.skalenodes.com/",
[NetworkNames.SkaleCalypso]:
Expand Down Expand Up @@ -53,6 +54,10 @@ const NetworkEndpoints: Record<string, string> = {
[NetworkNames.Syscoin]: "https://explorer.syscoin.org/",
[NetworkNames.RolluxTest]: "https://rollux.tanenbaum.io/",
[NetworkNames.Rollux]: "https://explorer.rollux.com/",
[NetworkNames.Blast]: "https://blastscan.io/",
[NetworkNames.Sanko]: "https://explorer.sanko.xyz/",
[NetworkNames.Degen]: "https://explorer.degen.tips/",
[NetworkNames.Ham]: "https://explorer.ham.fun/",
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getAddressActivity = async (
).then((res) => {
if (res.status === "0") return [];
const results = res.result as EtherscanTxType[];
const newResults = results.reverse().map((tx) => {
const newResults = results.map((tx) => {
const rawTx: EthereumRawInfo = {
blockHash: tx.blockHash,
blockNumber: numberToHex(tx.blockNumber),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NetworkNames } from "@enkryptcom/types";

const NetworkEndpoints: Record<string, string> = {
[NetworkNames.Telos]: "https://api.teloscan.io/",
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import cacheFetch from "@/libs/cache-fetch";
import { EvmNetwork } from "@/providers/ethereum/types/evm-network";
import {
Activity,
ActivityStatus,
ActivityType,
EthereumRawInfo,
} from "@/types/activity";
import { BaseNetwork } from "@/types/base-network";
import { numberToHex } from "web3-utils";
import { decodeTx } from "../../../transaction/decoder";
import { NetworkEndpoints } from "./configs";
import { TelosTXType } from "./types";
const TTL = 30000;
const getAddressActivity = async (
address: string,
endpoint: string
): Promise<EthereumRawInfo[]> => {
return cacheFetch(
{
url: `${endpoint}v1/address/${address}/transactions`,
},
TTL
).then((res) => {
if (!res.success) return [];
const results = res.results as TelosTXType[];
const newResults = results.map((tx) => {
const rawTx: EthereumRawInfo = {
blockHash: "0x",
blockNumber: numberToHex(tx.blockNumber),
contractAddress: tx.contractAddress
? tx.contractAddress.toLowerCase()
: null,
data: tx.input,
effectiveGasPrice: tx.gasPrice,
from: tx.from.toLowerCase(),
to: tx.to === "" ? null : tx.to.toLowerCase(),
gas: tx.gasLimit,
gasUsed: tx.gasused,
nonce: numberToHex(tx.nonce),
status: tx.status === "0x1" ? true : false,
transactionHash: tx.hash,
value: tx.value,
timestamp: tx.timestamp,
};
return rawTx;
});
return newResults.slice(0, 50) as EthereumRawInfo[];
});
};
export default async (
network: BaseNetwork,
address: string
): Promise<Activity[]> => {
address = address.toLowerCase();
const enpoint =
NetworkEndpoints[network.name as keyof typeof NetworkEndpoints];
const activities = await getAddressActivity(address, enpoint);
const Promises = activities.map((activity) => {
return decodeTx(activity, network as EvmNetwork).then((txData) => {
return {
from: activity.from,
to: activity.contractAddress
? activity.contractAddress
: txData.tokenTo!,
isIncoming: activity.from !== address,
network: network.name,
rawInfo: activity,
status: activity.status
? ActivityStatus.success
: ActivityStatus.failed,
timestamp: activity.timestamp ? activity.timestamp : 0,
value: txData.tokenValue,
transactionHash: activity.transactionHash,
type: ActivityType.transaction,
nonce: activity.nonce,
token: {
decimals: txData.tokenDecimals,
icon: txData.tokenImage,
name: txData.tokenName,
symbol: txData.tokenSymbol,
price: txData.currentPriceUSD.toString(),
},
};
});
});
return Promise.all(Promises);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface TelosTXType {
gasused: string;
contractAddress: string;
index: number;
nonce: number;
input: string;
gasLimit: string;
blockNumber: number;
from: string;
to: string;
value: string;
hash: string;
timestamp: number;
gasPrice: string;
status: "0x1" | "0x0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@ const supportedNetworks: Record<SupportedNetworkNames, SupportedNetwork> = {
tbName: "rollux",
cgPlatform: CoingeckoPlatform.Rollux,
},
[NetworkNames.Telos]: {
tbName: "tlos",
cgPlatform: CoingeckoPlatform.Telos,
},
[NetworkNames.Blast]: {
tbName: "blast",
cgPlatform: CoingeckoPlatform.Blast,
},
[NetworkNames.Sanko]: {
tbName: "sanko",
cgPlatform: CoingeckoPlatform.Sanko,
},
[NetworkNames.Degen]: {
tbName: "degen",
cgPlatform: CoingeckoPlatform.Degen,
},
};

const getTokens = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const TokenList: Record<SupportedNetworkNames, string> = {
[NetworkNames.TomoChain]: `https://tokens.coingecko.com/${CoingeckoPlatform.TomoChain}/all.json`,
[NetworkNames.Shibarium]: `https://tokens.coingecko.com/${CoingeckoPlatform.Shibarium}/all.json`,
[NetworkNames.Rollux]: `https://tokens.coingecko.com/${CoingeckoPlatform.Rollux}/all.json`,
[NetworkNames.Telos]: `https://tokens.coingecko.com/${CoingeckoPlatform.Telos}/all.json`,
[NetworkNames.Blast]: `https://tokens.coingecko.com/${CoingeckoPlatform.Blast}/all.json`,
[NetworkNames.Sanko]: `https://tokens.coingecko.com/${CoingeckoPlatform.Sanko}/all.json`,
[NetworkNames.Degen]: `https://tokens.coingecko.com/${CoingeckoPlatform.Degen}/all.json`,
};

const getKnownNetworkTokens = async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ export type SupportedNetworkNames =
| NetworkNames.MaticZK
| NetworkNames.Celo
| NetworkNames.ZkSync
| NetworkNames.Rollux;
| NetworkNames.Telos
| NetworkNames.Rollux
| NetworkNames.Sanko
| NetworkNames.Degen
| NetworkNames.Blast;
27 changes: 27 additions & 0 deletions packages/extension/src/providers/ethereum/networks/blast.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types";
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew";
import { EtherscanActivity } from "../libs/activity-handlers";
import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler";

const ethOptions: EvmNetworkOptions = {
name: NetworkNames.Blast,
name_long: "Blast",
homePage: "https://blast.io/en",
blockExplorerTX: "https://blastscan.io/tx/[[txHash]]",
blockExplorerAddr: "https://blastscan.io/address/[[address]]",
chainID: "0x13e31",
isTestNetwork: false,
currencyName: "ETH",
currencyNameLong: "Ethereum",
node: "wss://blast-rpc.publicnode.com",
icon: require("./icons/blast.webp"),
coingeckoID: "ethereum",
coingeckoPlatform: CoingeckoPlatform.Blast,
assetsInfoHandler,
activityHandler: wrapActivityHandler(EtherscanActivity),
};

const eth = new EvmNetwork(ethOptions);

export default eth;
27 changes: 27 additions & 0 deletions packages/extension/src/providers/ethereum/networks/degen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types";
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew";
import { EtherscanActivity } from "../libs/activity-handlers";
import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler";

const ethOptions: EvmNetworkOptions = {
name: NetworkNames.Degen,
name_long: "Degen",
homePage: "https://www.degen.tips/",
blockExplorerTX: "https://explorer.degen.tips/tx/[[txHash]]",
blockExplorerAddr: "https://explorer.degen.tips/address/[[address]]",
chainID: "0x27bc86aa",
isTestNetwork: false,
currencyName: "DEGEN",
currencyNameLong: "DEGEN",
node: "https://rpc.degen.tips",
icon: require("./icons/degen.png"),
coingeckoID: "degen-base",
coingeckoPlatform: CoingeckoPlatform.Degen,
assetsInfoHandler,
activityHandler: wrapActivityHandler(EtherscanActivity),
};

const eth = new EvmNetwork(ethOptions);

export default eth;
27 changes: 27 additions & 0 deletions packages/extension/src/providers/ethereum/networks/dmt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types";
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew";
import { EtherscanActivity } from "../libs/activity-handlers";
import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler";

const ethOptions: EvmNetworkOptions = {
name: NetworkNames.Sanko,
name_long: "Sanko",
homePage: "https://sanko.xyz",
blockExplorerTX: "https://explorer.sanko.xyz/tx/[[txHash]]",
blockExplorerAddr: "https://explorer.sanko.xyz/address/[[address]]",
chainID: "0x7cc",
isTestNetwork: false,
currencyName: "DMT",
currencyNameLong: "DMT",
node: "https://mainnet.sanko.xyz",
icon: require("./icons/sanko.png"),
coingeckoID: "dream-machine-token",
coingeckoPlatform: CoingeckoPlatform.Sanko,
assetsInfoHandler,
activityHandler: wrapActivityHandler(EtherscanActivity),
};

const eth = new EvmNetwork(ethOptions);

export default eth;
24 changes: 24 additions & 0 deletions packages/extension/src/providers/ethereum/networks/ham.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NetworkNames } from "@enkryptcom/types";
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
import { EtherscanActivity } from "../libs/activity-handlers";
import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler";

const ethOptions: EvmNetworkOptions = {
name: NetworkNames.Ham,
name_long: "Ham Chain",
homePage: "https://ham.fun/",
blockExplorerTX: "https://explorer.ham.fun/tx/[[txHash]]",
blockExplorerAddr: "https://explorer.ham.fun/address/[[address]]",
chainID: "0x13f8",
isTestNetwork: false,
currencyName: "ETH",
currencyNameLong: "Ethereum",
node: "https://rpc.ham.fun",
icon: require("./icons/ham.png"),
coingeckoID: "ethereum",
activityHandler: wrapActivityHandler(EtherscanActivity),
};

const eth = new EvmNetwork(ethOptions);

export default eth;
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

2 comments on commit 8c76488

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.