@web3-onboard/keystone
Advanced tools
Comparing version 2.0.1 to 2.0.3
@@ -1,2 +0,2 @@ | ||
import { CustomNetwork, WalletInit } from '@web3-onboard/common'; | ||
import type { CustomNetwork, WalletInit } from '@web3-onboard/common'; | ||
declare function keystone({ customNetwork }?: { | ||
@@ -3,0 +3,0 @@ customNetwork?: CustomNetwork; |
@@ -1,2 +0,1 @@ | ||
import { accountSelect, createEIP1193Provider, ProviderRpcErrorCode, ProviderRpcError } from '@web3-onboard/common'; | ||
const DEFAULT_BASE_PATH = "m/44'/60'/0'/0"; | ||
@@ -53,5 +52,5 @@ const basePaths = [ | ||
const { StaticJsonRpcProvider } = await import('@ethersproject/providers'); | ||
const { default: Common, Hardfork } = await import('@ethereumjs/common'); | ||
const { default: AirGappedKeyring } = await import('@keystonehq/eth-keyring'); | ||
const { TransactionFactory: Transaction } = await import('@ethereumjs/tx'); | ||
const { accountSelect, createEIP1193Provider, ProviderRpcError, ProviderRpcErrorCode, getCommon } = await import('@web3-onboard/common'); | ||
const keyring = AirGappedKeyring.getEmptyKeyring(); | ||
@@ -80,2 +79,8 @@ await keyring.readKeyring(); | ||
}; | ||
const signMessage = (address, message) => { | ||
if (!(accounts && accounts.length && accounts.length > 0)) | ||
throw new Error('No account selected. Must call eth_requestAccounts first.'); | ||
const account = accounts.find(account => account.address === address) || accounts[0]; | ||
return keyring.signMessage(account.address, message); | ||
}; | ||
const request = async ({ method, params }) => { | ||
@@ -114,8 +119,4 @@ const response = await fetch(currentChain.rpcUrl, { | ||
}, | ||
eth_accounts: async () => { | ||
return accounts && accounts[0].address ? [accounts[0].address] : []; | ||
}, | ||
eth_chainId: async () => { | ||
return currentChain.id; | ||
}, | ||
eth_accounts: async () => accounts && accounts[0].address ? [accounts[0].address] : [], | ||
eth_chainId: async () => currentChain.id, | ||
eth_signTransaction: async ({ params: [transactionObject] }) => { | ||
@@ -134,11 +135,6 @@ if (!accounts) | ||
transactionObject = { ...transactionObject, from }; | ||
// @ts-ignore -- Due to weird commonjs exports | ||
const CommonConstructor = Common.default || Common; | ||
const common = new Common({ | ||
chain: customNetwork || Number.parseInt(currentChain.id) || 1, | ||
// Berlin is the minimum hardfork that will allow for EIP1559 | ||
hardfork: Hardfork.Berlin, | ||
// List of supported EIPS | ||
eips: [1559] | ||
}); | ||
const chainId = currentChain.hasOwnProperty('id') | ||
? Number.parseInt(currentChain.id) | ||
: 1; | ||
const common = await getCommon({ customNetwork, chainId }); | ||
transactionObject.gasLimit = | ||
@@ -164,9 +160,4 @@ transactionObject.gas || transactionObject.gasLimit; | ||
}, | ||
eth_sign: async ({ params: [address, message] }) => { | ||
if (!(accounts && accounts.length && accounts.length > 0)) | ||
throw new Error('No account selected. Must call eth_requestAccounts first.'); | ||
const account = accounts.find(account => account.address === address) || | ||
accounts[0]; | ||
return keyring.signMessage(account.address, message); | ||
}, | ||
eth_sign: async ({ params: [address, message] }) => signMessage(address, message), | ||
personal_sign: async ({ params: [message, address] }) => signMessage(address, message), | ||
eth_signTypedData: async ({ params: [address, typedData] }) => { | ||
@@ -173,0 +164,0 @@ if (!(accounts && accounts.length && accounts.length > 0)) |
{ | ||
"name": "@web3-onboard/keystone", | ||
"version": "2.0.1", | ||
"version": "2.0.3", | ||
"description": "Keystone module for web3-onboard", | ||
@@ -21,4 +21,3 @@ "module": "dist/index.js", | ||
"dependencies": { | ||
"@web3-onboard/common": "^2.0.0", | ||
"@ethereumjs/common": "^2.6.1", | ||
"@web3-onboard/common": "^2.0.7", | ||
"@ethereumjs/tx": "^3.4.0", | ||
@@ -25,0 +24,0 @@ "@ethersproject/providers": "^5.5.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
40893
298
- Removed@ethereumjs/common@^2.6.1
Updated@web3-onboard/common@^2.0.7