mirror of
https://github.com/andrei0x309/clear-wallet.git
synced 2024-11-18 23:41:10 +00:00
changes: for 1.2.1
This commit is contained in:
parent
f8942c87d0
commit
3eec5438fd
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## Manifest Version 1.2.1
|
||||
|
||||
- added support fro eth_getTransactionCount method
|
||||
|
||||
## Manifest Version 1.1.9
|
||||
|
||||
- added proxy in intial stub for send, request, sendAsync for better compatibility
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clear-wallet",
|
||||
"version": "1.1.10",
|
||||
"version": "1.2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -62,7 +62,8 @@ const allowedMethods = {
|
||||
'net_listening': true,
|
||||
'eth_coinbase': true,
|
||||
'wallet_addEthereumChain': true,
|
||||
'eth_getCode': true
|
||||
'eth_getCode': true,
|
||||
'eth_getTransactionCount': true,
|
||||
}
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
|
@ -3,8 +3,8 @@
|
||||
"name": "__MSG_appName__",
|
||||
"description": "__MSG_appDesc__",
|
||||
"default_locale": "en",
|
||||
"version": "1.1.9",
|
||||
"version_name": "1.1.9",
|
||||
"version": "1.2.1",
|
||||
"version_name": "1.2.1",
|
||||
"icons": {
|
||||
"16": "assets/extension-icon/wallet_16.png",
|
||||
"32": "assets/extension-icon/wallet_32.png",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { getSelectedAccount, getSelectedNetwork, smallRandomString, getSettings, clearPk, openTab, getUrl, addToHistory, getNetworks, strToHex } from '@/utils/platform';
|
||||
import { getSelectedAccount, getSelectedNetwork, smallRandomString, getSettings, clearPk, openTab, getUrl, addToHistory, getNetworks, strToHex, numToHexStr } from '@/utils/platform';
|
||||
import { userApprove, userReject, rIdWin, rIdData } from '@/extension/userRequest'
|
||||
import { signMsg, getBalance, getBlockNumber, estimateGas, sendTransaction, getGasPrice, getBlockByNumber, evmCall, getTxByHash, getTxReceipt, signTypedData, getCode } from '@/utils/wallet'
|
||||
import { signMsg, getBalance, getBlockNumber, estimateGas, sendTransaction, getGasPrice, getBlockByNumber, evmCall, getTxByHash, getTxReceipt, signTypedData, getCode, getTxCount } from '@/utils/wallet'
|
||||
import type { RequestArguments } from '@/extension/types'
|
||||
import { rpcError } from '@/extension/rpcConstants'
|
||||
import { updatePrices } from '@/utils/gecko'
|
||||
@ -114,6 +114,23 @@ const mainListner = (message: RequestArguments, sender:any, sendResponse: (a: an
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'eth_getTransactionCount': {
|
||||
try {
|
||||
if(message?.params?.[1]) {
|
||||
sendResponse(numToHexStr(Number(await getTxCount(message?.params?.[0] as string, message?.params?.[1] as string))))
|
||||
}else {
|
||||
sendResponse(numToHexStr(Number(await getTxCount(message?.params?.[0] as string))))
|
||||
}
|
||||
} catch {
|
||||
sendResponse({
|
||||
error: true,
|
||||
code: rpcError.USER_REJECTED,
|
||||
message: 'No network or user selected'
|
||||
})
|
||||
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'eth_getTransactionByHash': {
|
||||
try {
|
||||
sendResponse(await getTxByHash(message?.params?.[0] as string))
|
||||
|
@ -82,6 +82,16 @@ export const getFromMemonic = (memonic: string, index: number) => {
|
||||
return wallet.privateKey
|
||||
}
|
||||
|
||||
export const getTxCount = async (addr: string, block: null | string = null) => {
|
||||
const network = await getSelectedNetwork()
|
||||
const provider = new ethers.providers.JsonRpcProvider(network.rpc)
|
||||
if(block){
|
||||
return await provider.getTransactionCount(addr, block)
|
||||
} else {
|
||||
return await provider.getTransactionCount(addr)
|
||||
}
|
||||
}
|
||||
|
||||
export const sendTransaction = async ({ data= '', gas='0x0', to='', from='', value='0x0', gasPrice='0x0'}:
|
||||
{to: string, from: string, data: string, value: string, gas: string, gasPrice: string},
|
||||
gasEstimate: Promise<BigNumber> | null = null, pGasPrice : Promise<BigNumber> | null) => {
|
||||
|
Loading…
Reference in New Issue
Block a user