Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0bdcceb
feat: add_all_tlds_and paymentid
Candy9797 May 9, 2025
3ce9397
feat: code review
Candy9797 May 13, 2025
34c9791
feat: code review
Candy9797 May 13, 2025
6606496
feat: fix yarn build
Candy9797 May 13, 2025
eb9b005
devop: make necessary changes
kvhnuke May 14, 2025
f7b86b4
Merge pull request #693 from enkryptcom/develop
kvhnuke May 19, 2025
1316df5
devop: merge develop
kvhnuke May 20, 2025
0be733d
Add Hemi
jcvernaleo May 20, 2025
d155386
fix two typos
jcvernaleo May 20, 2025
becd17f
devop: add more ud tlds
kvhnuke May 21, 2025
cd4677a
devop: to address field
kvhnuke May 21, 2025
fe4ed5b
feat: add label to tx confirmation
olgakup May 21, 2025
6cab721
fix: ledger package issue
kvhnuke May 22, 2025
a375ae9
devop: switch trezor based on platform
kvhnuke May 22, 2025
274f157
devop: update yarn
kvhnuke May 23, 2025
37ee211
devop: fix ellipsis error
kvhnuke May 23, 2025
ab81f6c
devop: switch extension check
kvhnuke May 23, 2025
a3d14cf
fix: rootstock staking estimation fix
ahsan-javaiid May 22, 2025
081461f
devop: move trezor-web to dev dep
kvhnuke May 27, 2025
6b5a503
devop: move trezor-web to dev dep
kvhnuke May 27, 2025
fcce244
devop: move trezor-web to dev dep
kvhnuke May 27, 2025
e1dab4c
devop: follow similar logic
kvhnuke May 28, 2025
d29316e
devop: cleanup
kvhnuke May 29, 2025
c17d693
devop: package updates
kvhnuke May 29, 2025
5892e97
fix: conflicts
kvhnuke May 29, 2025
1c2c7f6
Merge pull request #699 from enkryptcom/devop/trezor-conditional
kvhnuke May 29, 2025
5490f2f
Merge pull request #696 from enkryptcom/feat/add-to-address
kvhnuke May 29, 2025
13807d4
Merge pull request #697 from ahsan-javaiid/fix/collective-staking-fee
kvhnuke May 29, 2025
3d888bf
Merge pull request #695 from jcvernaleo/jcv_hemi
kvhnuke May 29, 2025
e9e7cf2
devop: add hemi network
kvhnuke May 29, 2025
48c972f
fix: conflicts
kvhnuke May 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@swc/core": "^1.11.24",
"@swc/core": "^1.11.29",
"concurrently": "^9.1.2",
"husky": "^9.1.7",
"node-notifier": "^10.0.1",
Expand Down
14 changes: 7 additions & 7 deletions packages/extension-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"webextension-polyfill": "^0.12.0"
},
"devDependencies": {
"@types/node": "^22.15.17",
"@types/node": "^22.15.24",
"@types/webextension-polyfill": "^0.12.3",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"bumpp": "^10.1.0",
"eslint": "^9.26.0",
"@typescript-eslint/eslint-plugin": "^8.33.0",
"@typescript-eslint/parser": "^8.33.0",
"bumpp": "^10.1.1",
"eslint": "^9.27.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^10.1.5",
"eslint-import-resolver-alias": "^1.1.2",
Expand All @@ -58,9 +58,9 @@
"prettier": "^3.5.3",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsup": "^8.4.0",
"tsup": "^8.5.0",
"type-fest": "^4.41.0",
"typescript": "^5.8.3",
"typescript-eslint": "8.32.1"
"typescript-eslint": "8.33.0"
}
}
48 changes: 24 additions & 24 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "2.7.0",
"version": "2.8.0",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"watch:firefox": "yarn prebuild && cross-env BROWSER='firefox' vite"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.17.4",
"@amplitude/analytics-browser": "^2.17.6",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
"@enkryptcom/keyring": "workspace:^",
Expand All @@ -38,19 +38,19 @@
"@ethereumjs/wallet": "^2.0.4",
"@kadena/client": "^1.17.1",
"@kadena/pactjs-cli": "^1.17.1",
"@ledgerhq/hw-transport-webusb": "^6.29.4",
"@ledgerhq/hw-transport-webusb": "^6.29.5",
"@metamask/eth-sig-util": "^8.2.0",
"@metaplex-foundation/mpl-bubblegum": "^5.0.0",
"@metaplex-foundation/mpl-bubblegum": "^5.0.1",
"@metaplex-foundation/umi": "^1.2.0",
"@metaplex-foundation/umi-bundle-defaults": "^1.2.0",
"@polkadot/api": "^15.9.3",
"@polkadot/extension-inject": "^0.58.9",
"@polkadot/keyring": "^13.4.4",
"@polkadot/rpc-provider": "^15.9.3",
"@polkadot/types": "^15.9.3",
"@polkadot/types-known": "^15.9.3",
"@polkadot/ui-shared": "^3.13.1",
"@polkadot/util": "^13.4.4",
"@polkadot/api": "^15.10.2",
"@polkadot/extension-inject": "^0.58.10",
"@polkadot/keyring": "^13.5.1",
"@polkadot/rpc-provider": "^15.10.2",
"@polkadot/types": "^15.10.2",
"@polkadot/types-known": "^15.10.2",
"@polkadot/ui-shared": "^3.14.1",
"@polkadot/util": "^13.5.1",
"@polkadot/wasm-crypto": "^7.4.1",
"@solana-developers/helpers": "2.8.0",
"@solana/spl-token": "^0.4.13",
Expand Down Expand Up @@ -78,7 +78,7 @@
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue": "^3.5.16",
"vue-echarts": "7.0.3",
"vue-router": "^4.5.1",
"vue3-lottie": "^3.3.1",
Expand All @@ -99,13 +99,13 @@
"@rollup/plugin-typescript": "^12.1.2",
"@tsconfig/node20": "^20.1.5",
"@types/bs58": "^5.0.0",
"@types/chrome": "^0.0.322",
"@types/chrome": "^0.0.323",
"@types/ethereumjs-abi": "^0.6.5",
"@types/events": "^3.0.3",
"@types/fs-extra": "^11.0.4",
"@types/less": "^3.0.8",
"@types/lodash": "^4.17.16",
"@types/node": "^22.15.17",
"@types/lodash": "^4.17.17",
"@types/node": "^22.15.24",
"@types/semver": "^7.7.0",
"@types/url-parse": "^1.4.11",
"@types/utf-8-validate": "^5.0.2",
Expand All @@ -116,28 +116,28 @@
"@vue/eslint-config-prettier": "^10.2.0",
"@vue/eslint-config-typescript": "^14.5.0",
"@vue/tsconfig": "^0.7.0",
"@vueuse/core": "^13.1.0",
"@vueuse/core": "^13.3.0",
"cross-env": "^7.0.3",
"eslint": "^9.26.0",
"eslint": "^9.27.0",
"eslint-plugin-vue": "^10.1.0",
"fs-extra": "^11.3.0",
"jsdom": "^26.1.0",
"less": "^4.3.0",
"less-loader": "^12.3.0",
"npm-run-all2": "^8.0.1",
"npm-run-all2": "^8.0.4",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"rollup": "^4.40.2",
"rollup-plugin-visualizer": "^5.14.0",
"rollup": "^4.41.1",
"rollup-plugin-visualizer": "^6.0.1",
"semver": "^7.7.2",
"systeminformation": "^5.25.11",
"tsup": "^8.4.0",
"systeminformation": "^5.27.1",
"tsup": "^8.5.0",
"typescript": "~5.8.3",
"url": "^0.11.4",
"vite": "^6.3.5",
"vite-plugin-node-polyfills": "0.23.0",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.1.3",
"vitest": "^3.1.4",
"vue-tsc": "^2.2.10",
"webextension-polyfill": "^0.12.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/src/libs/name-resolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class GenericNameResolver {
});
}

async resolveName(name: string, coins: CoinType[]): Promise<string | null> {
async resolveName(name: string, coins: CoinType[], providerChain?: string): Promise<string | null> {
let response: string | null = null;
for (const coin of coins) {
response = await this.nameResolver
.resolveAddress(name, coin)
.resolveAddress(name, coin, providerChain)
.catch(() => null);
if (response) return response;
}
Expand Down
6 changes: 1 addition & 5 deletions packages/extension/src/providers/common/libs/new-features.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { NetworkNames } from '@enkryptcom/types';

const newNetworks: NetworkNames[] = [
NetworkNames.Derive,
NetworkNames.Conflux,
NetworkNames.UnitZero,
];
const newNetworks: NetworkNames[] = [NetworkNames.Hemi];
const newSwaps: NetworkNames[] = [];

export { newNetworks, newSwaps };
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ const isChecked = (address: string) => {
props.network.displayAddress(address)
);
} catch (err) {
console.error('Error checking if address is checked', err);
console.error(
'Error checking if address is checked, probably name resolver',
);
return false;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
&__logo {
margin-bottom: 8px;
}
&__label {
font-size: 12px;
line-height: 16px;
letter-spacing: 0.5px;
color: @grayPrimary;
margin: 0 0 4px 44px;
}
&__network {
display: flex;
justify-content: flex-start;
Expand Down Expand Up @@ -167,11 +174,11 @@

&-to {
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 20px;
letter-spacing: 0.25px;
color: @primaryLabel;
font-weight: 400 !important;
font-size: 16px !important;
line-height: 20px !important;
letter-spacing: 0.5px;
color: @black !important;
word-break: break-all;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const NetworkEndpoints: Record<string, string> = {
[NetworkNames.CytonicTestnet]: 'https://explorer-api.evm.testnet.cytonic.com/api/',
[NetworkNames.Derive]: 'https://explorer.derive.xyz/',
[NetworkNames.Conflux]: 'https://evmapi.confluxscan.org/',
[NetworkNames.Hemi]: 'https://explorer.hemi.xyz/',
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import BigNumber from 'bignumber.js';
import { toBN, toWei } from 'web3-utils';
import { BNType, GasPriceTypes } from '@/providers/common/types';
import rsk from '../../networks/rsk';
import rskTestnet from '../../networks/rsk-testnet';
import { FeeHistoryResult } from 'web3-eth';
import { FormattedFeeHistory } from './types';

Expand Down Expand Up @@ -177,9 +179,72 @@ const FeeDescriptions = {
eta: '30 secs',
},
};
const collectiveGasConfig = {
[rsk.chainID]: { // rsk mainnet
stakingUrl: 'https://rootstock.blockscout.com/api/v2/tokens/0x5db91e24BD32059584bbDb831A901f1199f3d459/transfers',
txUrl: 'https://rootstock.blockscout.com/api/v2/transactions',
method: 'depositAndDelegate',
methodId: '0xfbde32f8',
},
[rskTestnet.chainID]: { // rsk testnet
stakingUrl: 'https://rootstock-testnet.blockscout.com/api/v2/tokens/0xc4b091D97ad25cEa5922F09fE80711B7acbBB16f/transfers',
txUrl: 'https://rootstock-testnet.blockscout.com/api/v2/transactions',
method: 'depositAndDelegate',
methodId: '0xfbde32f8',
}
};

const safeGasForStaking = async (chainID: string, estimatedGas: number) => {
const gasConfig = collectiveGasConfig[chainID];
try {
const stakingResponse = await fetch(gasConfig.stakingUrl);
if (!stakingResponse.ok) {
return estimatedGas;
}
const stakingTxHistory = await stakingResponse.json();

for (const tx of stakingTxHistory.items) {
// find stake tx
if (tx.method === gasConfig.method) {
const txDetailsResponse = await fetch(`${gasConfig.txUrl}/${tx.transaction_hash}`);

if (!txDetailsResponse.ok) {
return estimatedGas;
}
const txDetail = await txDetailsResponse.json();
// tx must be successfull
if (txDetail.status === 'ok') {
const txGasLimit = Number(txDetail.gas_limit);
const txGasUsed = Number(txDetail.gas_used);
// if web3 estimate gas is less than previous stake tx gas used
// This could cause tx to fail due to less gas
// Bump the gas limit particularly in this case
if (estimatedGas < txGasUsed) {
// Check if need to add buffer
const usedGasPercentage = txGasUsed / txGasLimit * 100;
if (usedGasPercentage > 80) {
// add a safe buffer of 30%
return Math.max(txGasUsed + (txGasUsed * 0.30), txGasLimit);
}
// safe buffer not required, just use gas limit
return txGasLimit;
}
// safe to use max of estimate or tx gas limit
return Math.max(estimatedGas, txGasLimit);
}
}
}
// No previous stake tx found, just return web3 estimated gas.
return estimatedGas;
} catch {
return estimatedGas;
}
};
export {
getBaseFeeBasedOnType,
getPriorityFeeBasedOnType,
safeGasForStaking,
collectiveGasConfig,
getGasBasedOnType,
FeeDescriptions,
formatFeeHistory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ import {
formatFeeHistory,
getBaseFeeBasedOnType,
getGasBasedOnType,
safeGasForStaking,
collectiveGasConfig,
getPriorityFeeBasedOnType,
} from './gas-utils';
import rsk from '../../networks/rsk';
import rskTestnet from '../../networks/rsk-testnet';
import { Hardfork, Common } from '@ethereumjs/common';
import { FeeMarketEIP1559Transaction, LegacyTransaction } from '@ethereumjs/tx';
import { OPTIMISM_PRICE_ORACLE, OPTIMISM_PRICE_ORACLE_ABI } from './op-data';
Expand Down Expand Up @@ -105,9 +109,13 @@ class Transaction {
if (!isFeeMarketNetwork) {
// Legacy transaction
const gasPrice = await this.web3.getGasPrice();
const gasLimit =
let gasLimit =
this.tx.gasLimit ||
(numberToHex(await this.estimateGas()) as `0x${string}`);
if ([rsk.chainID, rskTestnet.chainID].includes(this.tx.chainId) && this.tx.data &&
this.tx.data.startsWith(collectiveGasConfig[this.tx.chainId].methodId)) {
gasLimit = (numberToHex(await safeGasForStaking(this.tx.chainId, Number(gasLimit))) as `0x${string}`)
}
const legacyTx: FinalizedLegacyEthereumTransaction = {
to: this.tx.to || undefined,
chainId: this.tx.chainId,
Expand Down
25 changes: 25 additions & 0 deletions packages/extension/src/providers/ethereum/networks/hemi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import icon from './icons/hemi.webp';
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 hemiOptions: EvmNetworkOptions = {
name: NetworkNames.Hemi,
name_long: 'Hemi',
homePage: 'https://hemi.xyz/',
blockExplorerTX: 'https://explorer.hemi.xyz/tx/[[txHash]]',
blockExplorerAddr: 'https://explorer.hemi.xyz/address/[[address]]',
chainID: '0xa867',
isTestNetwork: false,
currencyName: 'ETH',
currencyNameLong: 'Ethereum',
node: 'wss://rpc.hemi.network/wsrpc',
coingeckoID: 'ethereum',
icon,
activityHandler: wrapActivityHandler(EtherscanActivity),
};

const hemi = new EvmNetwork(hemiOptions);

export default hemi;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/extension/src/providers/ethereum/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import cytonicTestnetNode from './cytonic-testnet';
import unitZero from './unitzero';
import unitZeroTestnet from './unitzero-testnet';
import conflux from './conflux';
import hemi from './hemi';

export default {
sepolia: sepoliaNode,
Expand Down Expand Up @@ -165,4 +166,5 @@ export default {
unitZero: unitZero,
unitZeroTestnet: unitZeroTestnet,
conflux: conflux,
hemi: hemi,
};
Loading
Loading