Skip to content

Commit

Permalink
Merge pull request #366 from enkryptcom/devop/minor-updates
Browse files Browse the repository at this point in the history
devop: package updates
  • Loading branch information
kvhnuke authored Jan 3, 2024
2 parents 5952aa7 + 0b22e4d commit 8375c1a
Show file tree
Hide file tree
Showing 48 changed files with 2,998 additions and 1,775 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"version:apply": "yarn version apply --all"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@swc/core": "^1.3.84",
"concurrently": "^8.2.1",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@swc/core": "^1.3.100",
"concurrently": "^8.2.2",
"devmoji": "^2.3.0",
"husky": "^8.0.3",
"node-notifier": "^10.0.1",
"nodemon": "^3.0.1",
"nodemon": "^3.0.2",
"ultra-runner": "^3.10.5"
},
"resolutions": {
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 @@ -34,23 +34,23 @@
],
"dependencies": {
"nanoevents": "^7.0.1",
"serialize-error": "11.0.2",
"serialize-error": "11.0.3",
"tiny-uid": "^1.1.2",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@types/chai": "^4.3.6",
"@types/mocha": "^10.0.1",
"@types/node": "^20.6.0",
"@types/webextension-polyfill": "^0.10.2",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.4",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bumpp": "^8.2.1",
"eslint": "^8.49.0",
"bumpp": "^9.2.0",
"eslint": "^8.55.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.10.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-module-resolver": "^1.5.0",
"prettier": "^2.8.8",
"ts-node": "^10.9.1",
Expand Down
1 change: 1 addition & 0 deletions packages/extension/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
plugins: ["@babel/plugin-transform-class-static-block"],
presets: ["@vue/cli-plugin-babel/preset"],
};
1 change: 1 addition & 0 deletions packages/extension/configs/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const setConfig = (config) => {
args[0]["process.env"] = {
..._base,
PACKAGE_VERSION: JSON.stringify(package.version),
BUILD_TIME: new Date().toLocaleString().replace(/\D/g, ""),
IS_DEV: process.env.NODE_ENV === "development",
IS_FIREFOX: BROWSER === browserNames.firefox,
PREFILL_PASSWORD:
Expand Down
93 changes: 47 additions & 46 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.29.0",
"version": "1.30.0",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand All @@ -18,7 +18,7 @@
"watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean"
},
"dependencies": {
"@babel/runtime": "^7.22.15",
"@babel/runtime": "^7.23.5",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
"@enkryptcom/keyring": "workspace:^",
Expand All @@ -29,23 +29,23 @@
"@enkryptcom/utils": "workspace:^",
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@ledgerhq/hw-transport-webusb": "^6.27.19",
"@metamask/eth-sig-util": "^6.0.1",
"@rollup/plugin-replace": "^5.0.2",
"@types/chrome": "^0.0.245",
"@types/events": "^3.0.0",
"@types/less": "^3.0.4",
"@types/lodash": "^4.14.198",
"@types/utf-8-validate": "^5.0.0",
"@ledgerhq/hw-transport-webusb": "^6.28.0",
"@metamask/eth-sig-util": "^6.0.2",
"@rollup/plugin-replace": "^5.0.5",
"@types/chrome": "^0.0.250",
"@types/events": "^3.0.3",
"@types/less": "^3.0.6",
"@types/lodash": "^4.14.202",
"@types/utf-8-validate": "^5.0.2",
"@vueuse/core": "^9.13.0",
"add": "^2.0.6",
"bignumber.js": "^9.1.2",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.3",
"bitcoinjs-lib": "^6.1.5",
"bitcoinjs-message": "^2.2.0",
"chai": "^4.3.8",
"concurrently": "^8.2.1",
"core-js": "^3.32.2",
"chai": "^4.3.10",
"concurrently": "^8.2.2",
"core-js": "^3.34.0",
"echarts": "^5.4.3",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.1.5",
Expand All @@ -55,41 +55,42 @@
"memoize-one": "^6.0.0",
"moment": "^2.29.4",
"nanoevents": "^7.0.1",
"pinia": "^2.1.6",
"pinia": "^2.1.7",
"qrcode.vue": "^3.4.1",
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^9.0.0",
"vue": "^3.3.4",
"vue-echarts": "^6.6.1",
"vue-router": "4.2.4",
"uuid": "^9.0.1",
"vue": "^3.3.10",
"vue-echarts": "6.6.1",
"vue-router": "4.2.5",
"vue3-lottie": "^2.7.4",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.10.2",
"web3-utils": "^1.10.2",
"yarn": "^1.22.19",
"web3-eth": "^1.10.3",
"web3-utils": "^1.10.3",
"yarn": "^1.22.21",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@polkadot/api": "^10.9.1",
"@polkadot/extension-inject": "^0.46.5",
"@polkadot/keyring": "^12.4.2",
"@polkadot/rpc-provider": "^10.9.1",
"@polkadot/types": "^10.9.1",
"@polkadot/types-known": "^10.9.1",
"@polkadot/ui-shared": "^3.6.2",
"@polkadot/util": "^12.4.2",
"@polkadot/wasm-crypto": "^7.2.2",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-inject": "^5.0.3",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-typescript": "^11.1.3",
"@types/ethereumjs-abi": "^0.6.3",
"@types/mocha": "^10.0.1",
"@types/url-parse": "^1.4.9",
"@types/uuid": "^9.0.3",
"@types/wif": "^2.0.2",
"@types/zxcvbn": "^4.4.2",
"@babel/plugin-transform-class-static-block": "^7.23.4",
"@polkadot/api": "^10.11.1",
"@polkadot/extension-inject": "^0.46.6",
"@polkadot/keyring": "^12.6.1",
"@polkadot/rpc-provider": "^10.11.1",
"@polkadot/types": "^10.11.1",
"@polkadot/types-known": "^10.11.1",
"@polkadot/ui-shared": "^3.6.4",
"@polkadot/util": "^12.6.1",
"@polkadot/wasm-crypto": "^7.3.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-inject": "^5.0.5",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.5",
"@types/ethereumjs-abi": "^0.6.5",
"@types/mocha": "^10.0.6",
"@types/url-parse": "^1.4.11",
"@types/uuid": "^9.0.7",
"@types/wif": "^2.0.5",
"@types/zxcvbn": "^4.4.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vue/cli-plugin-babel": "~5.0.8",
Expand All @@ -100,7 +101,7 @@
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.49.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^8.7.1",
Expand All @@ -110,16 +111,16 @@
"mocha": "^10.2.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.1",
"rollup": "^3.29.1",
"rimraf": "^5.0.5",
"rollup": "^3.29.4",
"rollup-plugin-uglify": "^6.0.4",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.21.4",
"systeminformation": "^5.21.20",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5",
"url": "^0.11.2",
"url": "^0.11.3",
"webextension-polyfill": "^0.10.0"
},
"installConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/libs/settings-state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SettingsState {
async getSubstrateSettings(): Promise<SubstrateSettingsType> {
const state = await this.getStateByKey(StorageKeys.substrateState);
const settings: SubstrateSettingsType = {
injectPolkadotjs: true,
injectPolkadotjs: false,
};
return merge(settings, state);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/providers/bitcoin/libs/api-ss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class API implements ProviderAPIInterface {
return toBN(balance.balance)
.add(toBN(balance.unconfirmedBalance))
.toString();
});
})
.catch(() => "0");
}
async broadcastTx(rawtx: string): Promise<boolean> {
return fetch(`${this.node}/api/v1/send`, {
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/providers/bitcoin/libs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class API implements ProviderAPIInterface {
.then((balance: HaskoinBalanceType) => {
if ((balance as any).error) return "0";
return toBN(balance.confirmed).addn(balance.unconfirmed).toString();
});
})
.catch(() => "0");
}
async broadcastTx(rawtx: string): Promise<boolean> {
return fetch(`${this.node}transactions`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const SSFeeHandler = async (
.then((json: FeeType) => {
if (json.fast.satsPerKiloByte < 0)
json.fast.satsPerKiloByte = json.average.satsPerKiloByte;
if (json.average.satsPerKiloByte < 0)
json.average.satsPerKiloByte = json.slow.satsPerKiloByte;
return {
[GasPriceTypes.FASTEST]:
Math.ceil(json.fast.satsPerKiloByte / 1024) + 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const bitcoinOptions: BitcoinNetworkOptions = {
wif: 0xef,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000 * 2,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const bitcoinOptions: BitcoinNetworkOptions = {
wif: 0x80,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const dogeOptions: BitcoinNetworkOptions = {
wif: 0x9e,
dustThreshold: null,
paymentType: PaymentType.P2PKH,
maxFeeRate: 5000 * 4,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const litecoinOptions: BitcoinNetworkOptions = {
wif: 0xb0,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000 * 2,
},
};

Expand Down
1 change: 1 addition & 0 deletions packages/extension/src/providers/bitcoin/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface BitcoinNetworkInfo {
wif: number;
dustThreshold: null;
paymentType: PaymentType;
maxFeeRate: number;
}

export interface HaskoinBalanceType {
Expand Down
5 changes: 4 additions & 1 deletion packages/extension/src/providers/bitcoin/ui/libs/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const TransactionSigner = (
});
},
};
const tx = new Psbt({ network: network.networkInfo });
const tx = new Psbt({
network: network.networkInfo,
maximumFeeRate: network.networkInfo.maxFeeRate,
});
payload.inputs
.map((u) => {
const res: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ onMounted(async () => {
});
const nativeBalanceAfterTransaction = computed(() => {
if (selectedAsset.value) {
if (
selectedAsset.value &&
isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)
) {
return toBN(selectedAsset.value.balance ?? "0").sub(
toBN(toBase(sendAmount.value ?? "0", selectedAsset.value.decimals!)).add(
toBN(
Expand Down
38 changes: 14 additions & 24 deletions packages/extension/src/providers/ethereum/libs/transaction/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Web3Eth from "web3-eth";
import Web3Eth, { FeeHistoryResult } from "web3-eth";
import {
EthereumTransaction,
FinalizedFeeMarketEthereumTransaction,
Expand Down Expand Up @@ -69,26 +69,19 @@ class Transaction {
gasLimit: string;
formattedFeeHistory?: FormattedFeeHistory;
}> {
const { isFeeMarketNetwork, baseFeePerGas } = await this.web3
.getBlock("pending", false)
.then((block) => {
if (block) {
return {
isFeeMarketNetwork: !!block.baseFeePerGas,
baseFeePerGas: block.baseFeePerGas?.toString(),
};
}
// some networks such as zksync era pending block is null
return this.web3.getBlock("latest", false).then((block) => {
return {
isFeeMarketNetwork: !!block.baseFeePerGas,
baseFeePerGas: block.baseFeePerGas?.toString(),
};
});
});
const gasPrice = await this.web3.getGasPrice();
const { isFeeMarketNetwork, feeHistory } = await this.web3
.getFeeHistory(6, "latest", GAS_PERCENTILES)
.then((history) => ({
isFeeMarketNetwork: true,
feeHistory: history,
}))
.catch(() => ({
isFeeMarketNetwork: false,
feeHistory: {} as FeeHistoryResult,
}));
const nonce = await this.web3.getTransactionCount(this.tx.from, "pending");
if (!isFeeMarketNetwork) {
const gasPrice = await this.web3.getGasPrice();
const gasLimit =
this.tx.gasLimit ||
(numberToHex(await this.estimateGas()) as `0x${string}`);
Expand All @@ -114,11 +107,8 @@ class Transaction {
gasLimit: legacyTx.gasLimit,
};
} else {
const feeHistory = await this.web3.getFeeHistory(
6,
"latest",
GAS_PERCENTILES
);
const baseFeePerGas =
feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 2]; // -2 since -1 is the pending block
const formattedFeeHistory = formatFeeHistory(feeHistory);
const feeMarket = this.getFeeMarketGasInfo(
baseFeePerGas!,
Expand Down
1 change: 0 additions & 1 deletion packages/extension/src/providers/ethereum/networks/aa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ 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";
import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew";

const artheraOptions: EvmNetworkOptions = {
name: NetworkNames.Arthera,
Expand Down
Loading

1 comment on commit 8375c1a

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