Skip to content

Commit

Permalink
Merge pull request #230 from enkryptcom/develop
Browse files Browse the repository at this point in the history
Release: v1.11.1
  • Loading branch information
kvhnuke authored Feb 10, 2023
2 parents 530b141 + c60a41a commit f1c9de4
Show file tree
Hide file tree
Showing 79 changed files with 2,394 additions and 1,789 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ jobs:
VIRUS_TOTAL_API_KEY: ${{secrets.VIRUS_TOTAL_API_KEY}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
docker run --rm -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "yarn build:all"
docker run --rm -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:chrome && yarn zip"
docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" enkrypt-build-container /bin/bash -c "yarn build:all"
docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:chrome && yarn zip"
FILE_SHA256=`sha256sum ./packages/extension/dist/release.zip | awk '{print $1}'`
curl --request GET --url https://www.virustotal.com/api/v3/files/upload_url --header "x-apikey: $VIRUS_TOTAL_API_KEY"
UPLOAD_URL=`curl --request GET --url https://www.virustotal.com/api/v3/files/upload_url --header "x-apikey: $VIRUS_TOTAL_API_KEY" | jq --raw-output '.data'`
curl --request POST --url "$UPLOAD_URL" --header "x-apikey: $VIRUS_TOTAL_API_KEY" --header 'Accept: application/json' --header 'Content-Type: multipart/form-data' -F "file=@./packages/extension/dist/release.zip"
VIRUS_TOTAL_URL_CHROME=https://www.virustotal.com/gui/file/$FILE_SHA256
docker run --rm -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:firefox && yarn zip"
docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:firefox && yarn zip"
FILE_SHA256=`sha256sum ./packages/extension/dist/release.zip | awk '{print $1}'`
curl --request GET --url https://www.virustotal.com/api/v3/files/upload_url --header "x-apikey: $VIRUS_TOTAL_API_KEY"
UPLOAD_URL=`curl --request GET --url https://www.virustotal.com/api/v3/files/upload_url --header "x-apikey: $VIRUS_TOTAL_API_KEY" | jq --raw-output '.data'`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@swc/core": "^1.3.26",
"@swc/core": "^1.3.32",
"concurrently": "^7.6.0",
"devmoji": "^2.3.0",
"husky": "^8.0.3",
Expand Down
16 changes: 8 additions & 8 deletions packages/extension-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@
"@antfu/eslint-config": "^0.27.0",
"@types/chai": "^4.3.4",
"@types/mocha": "^9.1.1",
"@types/node": "^18.11.18",
"@types/node": "^18.13.0",
"@types/webextension-polyfill": "^0.10.0",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"bumpp": "^8.2.1",
"eslint": "^8.31.0",
"eslint": "^8.33.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.27.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-module-resolver": "^1.5.0",
"prettier": "^2.8.2",
"prettier": "^2.8.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.2",
"tsup": "^6.5.0",
"tsup": "^6.6.0",
"type-fest": "^2.19.0",
"typescript": "^4.9.4",
"typescript": "^4.9.5",
"typescript-eslint": "0.0.1-alpha.0"
}
}
3 changes: 3 additions & 0 deletions packages/extension/configs/base-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const setConfig = (config) => {
http: require.resolve("stream-http"),
path: require.resolve("path-browserify"),
fs: false,
zlib: false,
net: false,
tls: false,
});
config
.plugin("buffer") // <-arbitrary name to give this plugin entry I guess?
Expand Down
50 changes: 25 additions & 25 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.10.2",
"version": "1.11.1",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand All @@ -19,7 +19,7 @@
"watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean"
},
"dependencies": {
"@acala-network/api": "^4.1.5",
"@acala-network/api": "^4.1.8-2.3",
"@enkryptcom/extension-bridge": "^0.0.1",
"@enkryptcom/hw-wallets": "^0.0.1",
"@enkryptcom/keyring": "^0.0.1",
Expand All @@ -29,51 +29,51 @@
"@enkryptcom/utils": "^0.0.1",
"@ethereumjs/common": "^3.0.2",
"@ethereumjs/tx": "^4.0.2",
"@ledgerhq/hw-transport-webusb": "^6.27.9",
"@ledgerhq/hw-transport-webusb": "^6.27.11",
"@metamask/eth-sig-util": "^5.0.2",
"@types/chrome": "^0.0.208",
"@types/chrome": "^0.0.212",
"@types/events": "^3.0.0",
"@types/less": "^3.0.3",
"@types/lodash": "^4.14.191",
"@types/utf-8-validate": "^5.0.0",
"@vueuse/core": "^9.10.0",
"@vueuse/core": "^9.12.0",
"add": "^2.0.6",
"bignumber.js": "^9.1.1",
"bip39": "^3.0.4",
"bitcoinjs-lib": "^6.1.0",
"bitcoinjs-message": "^2.2.0",
"chai": "^4.3.7",
"concurrently": "^7.6.0",
"core-js": "^3.27.1",
"core-js": "^3.27.2",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.1.5",
"ethereumjs-wallet": "^1.0.2",
"eventemitter3": "^4.0.7",
"eventemitter3": "^5.0.0",
"lodash": "^4.17.21",
"memoize-one": "^6.0.0",
"moment": "^2.29.4",
"nanoevents": "^7.0.1",
"pinia": "^2.0.28",
"pinia": "^2.0.30",
"qrcode.vue": "^3.3.3",
"url-parse": "^1.5.10",
"uuid": "^9.0.0",
"vue": "^3.2.45",
"vue": "^3.2.47",
"vue-router": "4.1.6",
"vue3-lottie": "^2.4.0",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.8.1",
"web3-utils": "^1.8.1",
"web3-eth": "^1.8.2",
"web3-utils": "^1.8.2",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@polkadot/api": "^9.11.1",
"@polkadot/api": "^9.13.6",
"@polkadot/extension-inject": "^0.44.8",
"@polkadot/keyring": "^10.2.3",
"@polkadot/rpc-provider": "^9.11.1",
"@polkadot/types": "^9.11.1",
"@polkadot/types-known": "^9.11.1",
"@polkadot/ui-shared": "^2.9.15",
"@polkadot/util": "^10.2.3",
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-provider": "^9.13.6",
"@polkadot/types": "^9.13.6",
"@polkadot/types-known": "^9.13.6",
"@polkadot/ui-shared": "^2.11.1",
"@polkadot/util": "^10.3.1",
"@polkadot/wasm-crypto": "^6.4.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-inject": "^4.0.4",
Expand All @@ -86,8 +86,8 @@
"@types/uuid": "^9.0.0",
"@types/wif": "^2.0.2",
"@types/zxcvbn": "^4.4.1",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
Expand All @@ -96,7 +96,7 @@
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.31.0",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^8.7.1",
Expand All @@ -105,16 +105,16 @@
"less-loader": "^11.1.0",
"mocha": "^10.2.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.2",
"rimraf": "^3.0.2",
"prettier": "^2.8.3",
"rimraf": "^4.1.2",
"rollup": "^2.79.1",
"rollup-plugin-uglify": "^6.0.4",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.17.3",
"systeminformation": "^5.17.8",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.1.2",
"typescript": "^4.9.4",
"typescript": "^4.9.5",
"url": "^0.11.0",
"webextension-polyfill": "^0.10.0"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/libs/dapp-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const lists: Partial<Record<NetworkNames, string>> = {
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/bifrost.json",
[NetworkNames.Edgeware]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/edg.json",
[NetworkNames.ZkSyncGoerli]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/zksyncgoerli.json",
};

export default lists;
1 change: 1 addition & 0 deletions packages/extension/src/libs/market-data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface CoingeckPlatforms {
gochain?: string;
"polygon-pos"?: string;
moonbeam?: string;
rootstock?: string;
}
export interface CoinGeckoToken {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/manifest/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "https://www.enkrypt.com",
"homepage_url": "https://www.enkrypt.com",
"version": "",
"name": "Enkrypt: Ethereum, Polkadot & Bitcoin Wallet",
"name": "Enkrypt: Ethereum, Polkadot & Canto Wallet",
"short_name": "Enkrypt",
"permissions": [
"storage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const nativeBalance = computed(() => {
);
if (accountIndex !== -1) {
const balance = props.accountInfo.activeBalances[accountIndex];
if (balance !== undefined) {
if (balance !== "~") {
return toBase(balance, props.network.decimals);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RivetActivity from "./providers/rivet";
import EtherscanActivity from "./providers/etherscan";
import OkcActivity from "./providers/okc";
export { RivetActivity, EtherscanActivity, OkcActivity };
import ZksynceActivity from "./providers/zksync";
export { RivetActivity, EtherscanActivity, OkcActivity, ZksynceActivity };
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const NetworkEndpoints = {
[NetworkNames.ShidenEVM]: "https://blockscout.com/shiden/",
[NetworkNames.Optimism]: "https://api-optimistic.etherscan.io/",
[NetworkNames.Canto]: "https://evm.explorer.canto.io/",
[NetworkNames.EdgeEVM]: "https://edgscan.live/",
[NetworkNames.Rootstock]: "https://blockscout.com/rsk/mainnet/",
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EvmNetwork } from "@/providers/ethereum/types/evm-network";
import { numberToHex, toBN } from "web3-utils";
import { numberToHex } from "web3-utils";
import {
Activity,
ActivityStatus,
Expand All @@ -9,6 +9,7 @@ import {
import { BaseNetwork } from "@/types/base-network";
import { decodeTx } from "../../../transaction/decoder";
import { NetworkEndpoints } from "./configs";
import { toBase } from "@/libs/utils/units";

interface OkcRawInfo {
blockHash: string;
Expand Down Expand Up @@ -57,7 +58,7 @@ const getAddressActivity = async (
nonce: numberToHex(0),
status: true,
transactionHash: tx.txId,
value: toBN(tx.amount).mul(toBN("1000000000000000000")).toString(),
value: toBase(tx.amount, 18),
timestamp: parseInt(tx.transactionTime),
};
return rawTx;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NetworkNames } from "@enkryptcom/types";

const NetworkEndpoints = {
[NetworkNames.ZkSyncGoerli]: "https://zksync2-testnet-explorer.zksync.dev/",
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { EvmNetwork } from "@/providers/ethereum/types/evm-network";
import { numberToHex } from "web3-utils";
import {
Activity,
ActivityStatus,
ActivityType,
EthereumRawInfo,
} from "@/types/activity";
import { BaseNetwork } from "@/types/base-network";
import { decodeTx } from "../../../transaction/decoder";
import { NetworkEndpoints } from "./configs";

interface zkSyncTxInfo {
transactionHash: string;
data: {
contractAddress: string;
calldata: string;
value: string;
};
status: string;
fee: string;
nonce: number;
blockNumber: number;
blockHash: string;
initiatorAddress: string;
receivedAt: string;
}

const getAddressActivity = async (
address: string,
endpoint: string
): Promise<EthereumRawInfo[]> => {
return fetch(
`${endpoint}transactions?limit=50&direction=older&accountAddress=${address}`,
{
headers: {
"Content-Type": "application/json",
},
}
)
.then((res) => res.json())
.then((res) => {
const results = res.list as zkSyncTxInfo[];
const newResults = results.map((tx) => {
const rawTx: EthereumRawInfo = {
blockHash: tx.blockHash,
blockNumber: numberToHex(tx.blockNumber),
contractAddress: tx.data.contractAddress,
data: tx.data.calldata,
effectiveGasPrice: numberToHex(0),
from: tx.initiatorAddress,
to: tx.data.contractAddress,
gas: "0x0",
gasUsed: "0x0",
nonce: numberToHex(tx.nonce),
status: tx.status !== "failed",
transactionHash: tx.transactionHash,
value: numberToHex(tx.data.value),
timestamp: new Date(tx.receivedAt).getTime(),
};
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: ActivityStatus.success,
timestamp: activity.timestamp ? activity.timestamp : 0,
value: txData.tokenValue,
transactionHash: activity.transactionHash,
type: ActivityType.transaction,
token: {
decimals: txData.tokenDecimals,
icon: txData.tokenImage,
name: txData.tokenName,
symbol: txData.tokenSymbol,
price: txData.currentPriceUSD.toString(),
},
};
});
});
return Promise.all(Promises);
};
Loading

2 comments on commit f1c9de4

@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.