-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from enkryptcom/develop
Release: v1.7.0
- Loading branch information
Showing
97 changed files
with
2,105 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import NameResolver, { CoinType } from "@enkryptcom/name-resolution"; | ||
class GenericNameResolver { | ||
nameResolver: NameResolver; | ||
|
||
constructor() { | ||
this.nameResolver = new NameResolver({ | ||
ens: { node: "https://nodes.mewapi.io/rpc/eth" }, | ||
}); | ||
} | ||
|
||
async resolveName(name: string, coins: CoinType[]): Promise<string | null> { | ||
let response: string | null = null; | ||
for (const coin of coins) { | ||
response = await this.nameResolver | ||
.resolveAddress(name, coin) | ||
.catch(() => null); | ||
if (response) return response; | ||
} | ||
return response; | ||
} | ||
} | ||
|
||
export { CoinType, GenericNameResolver }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/extension/src/providers/ethereum/libs/tx-broadcaster.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { NetworkNames } from "@enkryptcom/types"; | ||
import { v4 } from "uuid"; | ||
|
||
const broadcastTx = (hexTx: string, network: NetworkNames): Promise<string> => { | ||
if (network === NetworkNames.Ethereum) { | ||
const burl = "https://broadcast.mewapi.io/eth?product=enkrypt"; | ||
return fetch(burl, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
jsonrpc: "2.0", | ||
method: "eth_sendRawTransaction", | ||
params: [hexTx], | ||
id: v4(), | ||
}), | ||
}) | ||
.then((response) => response.json()) | ||
.then((jRes) => { | ||
if (jRes.error) return Promise.reject(jRes.error); | ||
else return jRes.result as string; | ||
}); | ||
} | ||
return Promise.reject("Not valid network"); | ||
}; | ||
|
||
export default broadcastTx; |
25 changes: 25 additions & 0 deletions
25
packages/extension/src/providers/ethereum/methods/eth_sendRawTransaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { getCustomError } from "@/libs/error"; | ||
import { MiddlewareFunction } from "@enkryptcom/types"; | ||
import EthereumProvider from ".."; | ||
import broadcastTx from "../libs/tx-broadcaster"; | ||
const method: MiddlewareFunction = function ( | ||
this: EthereumProvider, | ||
payload, | ||
res, | ||
next | ||
): void { | ||
if (payload.method !== "eth_sendRawTransaction") return next(); | ||
else { | ||
if (!payload.params || payload.params.length < 1) { | ||
return res( | ||
getCustomError("eth_sendTransaction: invalid request not enough params") | ||
); | ||
} | ||
broadcastTx(payload.params[0], this.network.name) | ||
.then((hash) => { | ||
res(null, hash); | ||
}) | ||
.catch(() => next()); | ||
} | ||
}; | ||
export default method; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/extension/src/providers/ethereum/networks/canto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; | ||
import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; | ||
import { EtherscanActivity } from "../libs/activity-handlers"; | ||
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; | ||
|
||
const cantoOptions: EvmNetworkOptions = { | ||
name: NetworkNames.Canto, | ||
name_long: "Canto", | ||
homePage: "https://canto.io/", | ||
blockExplorerTX: "https://evm.explorer.canto.io/tx/[[txHash]]", | ||
blockExplorerAddr: "https://evm.explorer.canto.io/address/[[address]]", | ||
chainID: "0x1e14", | ||
isTestNetwork: false, | ||
currencyName: "CANTO", | ||
currencyNameLong: "Canto", | ||
node: "https://canto.evm.chandrastation.com/", | ||
icon: require("./icons/canto.svg"), | ||
gradient: "linear-gradient(180deg, #C549FF 0%, #684CFF 100%)", | ||
coingeckoID: "canto", | ||
coingeckoPlatform: CoingeckoPlatform.Canto, | ||
activityHandler: wrapActivityHandler(EtherscanActivity), | ||
}; | ||
|
||
const canto = new EvmNetwork(cantoOptions); | ||
|
||
export default canto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/extension/src/providers/ethereum/networks/icons/canto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
packages/extension/src/providers/ethereum/networks/icons/op.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
d3d5641
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Virus total analysis
chrome:
https://www.virustotal.com/gui/file/1906144475d326053a75bc9eee8e5cf1699e073a718c373b19a5a079d2608592
firefox:
https://www.virustotal.com/gui/file/5e622ae793aa5bf42877418cf983ac4ff89f0f4a3eeb10dc2bd8d9fe3c61e17e
d3d5641
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Virus total analysis
chrome:
https://www.virustotal.com/gui/file/71f1d5bc5eb8022a1a2dbc903095b6088c2a33bf213c2f5a2a6696d1825ed8dd
firefox:
https://www.virustotal.com/gui/file/d84969fb1beb8a8090e9ae96005ea37c1296b0b87acfdea33399deeb433ccd1a