-
Notifications
You must be signed in to change notification settings - Fork 177
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 #230 from enkryptcom/develop
Release: v1.11.1
- Loading branch information
Showing
79 changed files
with
2,394 additions
and
1,789 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
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
3 changes: 2 additions & 1 deletion
3
packages/extension/src/providers/ethereum/libs/activity-handlers/index.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 |
---|---|---|
@@ -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 }; |
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
7 changes: 7 additions & 0 deletions
7
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/zksync/configs.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,7 @@ | ||
import { NetworkNames } from "@enkryptcom/types"; | ||
|
||
const NetworkEndpoints = { | ||
[NetworkNames.ZkSyncGoerli]: "https://zksync2-testnet-explorer.zksync.dev/", | ||
}; | ||
|
||
export { NetworkEndpoints }; |
102 changes: 102 additions & 0 deletions
102
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/zksync/index.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,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); | ||
}; |
Oops, something went wrong.
f1c9de4
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/c1aba6f43f287b0d46274d416d6d2b0bd5b211a4036bdf334f14918becf70746
firefox:
https://www.virustotal.com/gui/file/50d711f1ce95c2cfd3b84c9251566eee985d795e4c40760b7c723fec08ca6fde
f1c9de4
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/9149e26f43461baea2e4344d520b3f5186da8074af0c7e1b48fd9b452b335255
firefox:
https://www.virustotal.com/gui/file/a1bd47e63e33abb0310e5214f388294671cc57f6e643620d0f9a783704f1583a