Skip to content

Commit e49dcf7

Browse files
committed
devop: merge
2 parents a28a95a + 775e897 commit e49dcf7

File tree

48 files changed

+1721
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1721
-459
lines changed

README.md

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,82 @@ Enkrypt is a web3 wallet built from the ground up to support the multi-chain fut
3232
## Currently Supported Chains
3333

3434
- Ethereum
35-
- Polygon
36-
- BNB Smart Chain
37-
- Moonbeam
38-
- Moonriver
39-
- Karura EVM
40-
- Ethereum Classic
41-
- Polkadot
42-
- Kusama
43-
- Edgeware
35+
- Bitcoin
36+
- Solana
4437
- Acala
45-
- Karura
46-
- TomoChain
38+
- Amplitude
4739
- Arbitrum
48-
- Gnosis
40+
- Arbitrum Nova
41+
- Arthera
42+
- Astar
43+
- Astar EVM
44+
- Aurora
4945
- Avalanche
46+
- Base
47+
- Bifrost
48+
- Bifrost (Kusama)
49+
- Binance Smart Chain
50+
- Bitcoin Testnet
51+
- Bitrock
52+
- Blast
53+
- Caga Ankara Testnet
54+
- Canto
55+
- Celo
56+
- Degen
57+
- Dogecoin
58+
- Edgeware
59+
- Edgeware EVM
60+
- Ethereum Classic
5061
- Fantom
62+
- Forma
63+
- Fraxtal
64+
- Gnosis
65+
- Godwoken
66+
- Goerli
67+
- Ham Chain
68+
- Immutable zkEVM
69+
- Kadena
70+
- Karura
71+
- Karura EVM
5172
- Klaytn
52-
- Aurora
53-
- Ontology
73+
- Kusama
74+
- Linea
75+
- Litecoin
76+
- Manta Pacific
77+
- Mode
78+
- Moonbeam
79+
- Moonriver
80+
- OKX Chain
81+
- Ontology EVM
82+
- Opal
83+
- opBNB
84+
- Optimism
85+
- Palm Network
86+
- Pendulum
87+
- Polkadot
88+
- Polygon
89+
- Polygon zkEVM
90+
- Proof of Play Apex
5491
- Puppy Net
55-
- Arthera
56-
- Caga Ankara Testnet
92+
- Quartz
93+
- RARI Chain
94+
- Rollux
95+
- Rootstock
96+
- Sanko Chain
97+
- Scroll
98+
- Shibarium
99+
- Shiden
100+
- Shiden EVM
101+
- Sepolia
102+
- Syscoin
103+
- Telos EVM
104+
- Unique
105+
- Vara Network
106+
- Viction
107+
- Westend
108+
- ZChains
109+
- zkSync
110+
- zkSync Goerli
57111
- More coming soon!
58112

59113
Looking to add your project? [Contact us!](https://mewwallet.typeform.com/enkrypt-inquiry?typeform-source=www.enkrypt.com)

packages/extension/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# VITE_DEBUG_LOG="swap:*"
2+
VITE_DEBUG_LOG=

packages/extension/src/libs/cache-fetch/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const cacheFetch = async (
4242
.then(json => {
4343
const jsondata = options.postProcess ? options.postProcess(json) : json;
4444
const jsonstring = JSON.stringify(jsondata);
45-
if (!jsonstring.includes('error')) {
45+
if (!json.error) {
4646
const store: StoredData = {
4747
timestamp: new Date().getTime(),
4848
data: jsonstring,

packages/extension/src/libs/tokens-state/index.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class TokensState {
3535
if (
3636
t.type === TokenType.ERC20 &&
3737
(t as CustomErc20Token).address.toLowerCase() ===
38-
token.address.toLowerCase()
38+
token.address.toLowerCase()
3939
) {
4040
return false;
4141
}
@@ -54,6 +54,44 @@ export class TokensState {
5454
return true;
5555
}
5656

57+
/**
58+
* Remove a custom ERC20 token from a given network.
59+
* Returns `true` if the token was removed and false otherwise.
60+
* @param {NetworkNames} chainName - The name of the network the token is being removed from.
61+
* @param {string} address - The address of the token being removed.
62+
*/
63+
async removeErc20Token(
64+
chainName: NetworkNames,
65+
address: string,
66+
): Promise<boolean> {
67+
const state: IState | null = await this.storage.get(StorageKeys.customTokens);
68+
69+
if (state && state[chainName]) {
70+
const tokens = state[chainName];
71+
72+
for (let i = 0; i < tokens!.length; i++) {
73+
const token = tokens![i];
74+
75+
if (
76+
token.type === TokenType.ERC20 &&
77+
(token as CustomErc20Token).address.toLowerCase() ===
78+
address.toLowerCase()
79+
) {
80+
tokens!.splice(i, 1);
81+
82+
if (tokens!.length === 0) {
83+
delete state[chainName];
84+
}
85+
86+
await this.storage.set(StorageKeys.customTokens, state);
87+
return true;
88+
}
89+
}
90+
}
91+
92+
return false;
93+
}
94+
5795
async getTokensByNetwork(chainName: NetworkNames): Promise<CustomToken[]> {
5896
const state: IState | null = await this.storage.get(
5997
StorageKeys.customTokens,

packages/extension/src/libs/utils/number-formatter.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,19 @@ const toBNSafe = (number: number) => {
517517
return toBN(new BigNumber(number).toFixed(0));
518518
};
519519

520+
/**
521+
* Validates if a string represents a positive numeric value less than 2^256.
522+
* Used for validating transaction amounts across different blockchain implementations.
523+
* @param {string} value - The string value to validate
524+
* @returns {boolean} - True if the value is a valid positive number within bounds
525+
*/
526+
const isNumericPositive = (value: string) => {
527+
if (!value?.trim()) return false;
528+
const num = BigNumber(value);
529+
return !num.isNaN() && num.isPositive() && num.lt(new BigNumber(2).pow(256));
530+
};
531+
532+
520533
export {
521534
formatIntegerToString,
522535
formatIntegerValue,
@@ -526,4 +539,5 @@ export {
526539
formatPercentageValue,
527540
formatGasValue,
528541
toBNSafe,
542+
isNumericPositive
529543
};

packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ import { BTCToken } from '../../types/btc-token';
149149
import BigNumber from 'bignumber.js';
150150
import { defaultGasCostVals } from '@/providers/common/libs/default-vals';
151151
import { fromBase, toBase, isValidDecimals } from '@enkryptcom/utils';
152-
import { formatFloatingPointValue } from '@/libs/utils/number-formatter';
152+
import {
153+
formatFloatingPointValue,
154+
isNumericPositive,
155+
} from '@/libs/utils/number-formatter';
153156
import { routes as RouterNames } from '@/ui/action/router';
154157
import getUiPath from '@/libs/utils/get-ui-path';
155158
import Browser from 'webextension-polyfill';
@@ -218,6 +221,10 @@ onMounted(async () => {
218221
});
219222
220223
const nativeBalanceAfterTransaction = computed(() => {
224+
if (!isNumericPositive(sendAmount.value)) {
225+
return toBN(0);
226+
}
227+
221228
if (
222229
selectedAsset.value &&
223230
isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)
@@ -305,7 +312,10 @@ const isInputsValid = computed<boolean>(() => {
305312
isSendToken.value
306313
)
307314
return false;
308-
if (new BigNumber(sendAmount.value).gt(assetMaxValue.value)) return false;
315+
316+
const sendAmountBigNumber = new BigNumber(sendAmount.value)
317+
if (sendAmountBigNumber.isNaN()) return false
318+
if (sendAmountBigNumber.gt(assetMaxValue.value)) return false;
309319
return true;
310320
});
311321

packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ const amount = computed({
7373
7474
const onlyNumber = ($event: KeyboardEvent) => {
7575
const keyCode = $event.keyCode ? $event.keyCode : $event.which;
76-
if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) {
77-
$event.preventDefault();
76+
// Numeric
77+
if (keyCode >= /* 0 */ 48 && keyCode <= /* 9 */ 57) {
78+
return;
7879
}
80+
// Only allow a single period
81+
if (keyCode === /* '.' */ 46 && amount.value.indexOf('.') === -1) {
82+
return;
83+
}
84+
// Alphabetical (/non-numeric) or mulitple periods. Don't propagate change
85+
$event.preventDefault();
7986
};
8087
const changeFocus = () => {
8188
isFocus.value = !isFocus.value;

packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const NetworkEndpoints: Record<string, string> = {
6868
[NetworkNames.Mode]: 'https://explorer.mode.network/',
6969
[NetworkNames.ProofOfPlayApex]: 'https://explorer.apex.proofofplay.com/',
7070
[NetworkNames.Scroll]: 'https://api.scrollscan.com/',
71+
[NetworkNames.Fraxtal]: 'https://api.fraxscan.com/',
7172
};
7273

7374
export { NetworkEndpoints };

packages/extension/src/providers/ethereum/libs/transaction/gas-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const getGasBasedOnType = (
6262
}
6363
};
6464
const getMinPriorityFee = (): BNType => {
65-
return toBN(toWei('0.1', 'gwei'));
65+
return toBN(toWei('1', 'gwei'));
6666
};
6767
const getPriorityFeeAvg = (arr: BNType[]): BNType => {
6868
const sum = arr.reduce((a, v) => a.add(v));

0 commit comments

Comments
 (0)