@web3auth/ethereum-provider
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -85,3 +85,3 @@ module.exports = | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 11); | ||
/******/ return __webpack_require__(__webpack_require__.s = 10); | ||
/******/ }) | ||
@@ -105,3 +105,3 @@ /************************************************************************/ | ||
module.exports = require("loglevel"); | ||
module.exports = require("@web3auth/base"); | ||
@@ -124,3 +124,3 @@ /***/ }), | ||
module.exports = require("@web3auth/base"); | ||
module.exports = require("@toruslabs/base-controllers"); | ||
@@ -131,3 +131,3 @@ /***/ }), | ||
module.exports = require("@toruslabs/base-controllers"); | ||
module.exports = require("@web3auth/base-provider"); | ||
@@ -138,3 +138,3 @@ /***/ }), | ||
module.exports = require("@web3auth/base-provider"); | ||
module.exports = require("@ethereumjs/common"); | ||
@@ -145,3 +145,3 @@ /***/ }), | ||
module.exports = require("@ethereumjs/common"); | ||
module.exports = require("@ethereumjs/tx"); | ||
@@ -152,12 +152,6 @@ /***/ }), | ||
module.exports = require("@ethereumjs/tx"); | ||
module.exports = require("ethereumjs-util"); | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("ethereumjs-util"); | ||
/***/ }), | ||
/* 11 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -178,3 +172,3 @@ | ||
// EXTERNAL MODULE: external "@toruslabs/base-controllers" | ||
var base_controllers_ = __webpack_require__(6); | ||
var base_controllers_ = __webpack_require__(5); | ||
@@ -185,6 +179,6 @@ // EXTERNAL MODULE: external "@toruslabs/openlogin-jrpc" | ||
// EXTERNAL MODULE: external "@web3auth/base" | ||
var base_ = __webpack_require__(5); | ||
var base_ = __webpack_require__(2); | ||
// EXTERNAL MODULE: external "@web3auth/base-provider" | ||
var base_provider_ = __webpack_require__(7); | ||
var base_provider_ = __webpack_require__(6); | ||
@@ -468,2 +462,3 @@ // EXTERNAL MODULE: external "eth-rpc-errors" | ||
processTransaction, | ||
processSignTransaction, | ||
processEthSignMessage, | ||
@@ -484,2 +479,3 @@ processTypedMessage, | ||
processEthSignMessage, | ||
processSignTransaction, | ||
processTypedMessage, | ||
@@ -579,9 +575,4 @@ processTypedMessageV3, | ||
} | ||
// EXTERNAL MODULE: external "loglevel" | ||
var external_loglevel_ = __webpack_require__(2); | ||
var external_loglevel_default = /*#__PURE__*/__webpack_require__.n(external_loglevel_); | ||
// CONCATENATED MODULE: ./src/providers/injectedProviders/walletConnectUtils.ts | ||
function getProviderHandlers(_ref) { | ||
@@ -623,3 +614,2 @@ let { | ||
processTypedMessage: async (msgParams, _) => { | ||
external_loglevel_default.a.debug("processTypedMessage", msgParams); | ||
const result = await connector.signTypedData([msgParams.from, msgParams.data]); | ||
@@ -817,7 +807,7 @@ return result; | ||
// EXTERNAL MODULE: external "@ethereumjs/common" | ||
var common_ = __webpack_require__(8); | ||
var common_ = __webpack_require__(7); | ||
var common_default = /*#__PURE__*/__webpack_require__.n(common_); | ||
// EXTERNAL MODULE: external "@ethereumjs/tx" | ||
var tx_ = __webpack_require__(9); | ||
var tx_ = __webpack_require__(8); | ||
@@ -828,3 +818,3 @@ // EXTERNAL MODULE: external "@metamask/eth-sig-util" | ||
// EXTERNAL MODULE: external "ethereumjs-util" | ||
var external_ethereumjs_util_ = __webpack_require__(10); | ||
var external_ethereumjs_util_ = __webpack_require__(9); | ||
@@ -848,4 +838,4 @@ // CONCATENATED MODULE: ./src/providers/privateKeyProviders/ethPrivatekeyUtils.ts | ||
name, | ||
chainId: chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
chainId: !chainId || chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: !chainId || chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
hardfork | ||
@@ -903,3 +893,2 @@ }; | ||
processTypedMessage: async (msgParams, _) => { | ||
external_loglevel_default.a.debug("processTypedMessage", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -914,3 +903,2 @@ const sig = Object(eth_sig_util_["signTypedData"])({ | ||
processTypedMessageV3: async (msgParams, _) => { | ||
external_loglevel_default.a.debug("processTypedMessageV3", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -925,3 +913,2 @@ const sig = Object(eth_sig_util_["signTypedData"])({ | ||
processTypedMessageV4: async (msgParams, _) => { | ||
external_loglevel_default.a.debug("processTypedMessageV4", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -936,7 +923,6 @@ const sig = Object(eth_sig_util_["signTypedData"])({ | ||
processEncryptionPublicKey: async (address, _) => { | ||
external_loglevel_default.a.info("processEncryptionPublicKey", address); | ||
base_["log"].info("processEncryptionPublicKey", address); | ||
return Object(eth_sig_util_["getEncryptionPublicKey"])(privKey); | ||
}, | ||
processDecryptMessage: (msgParams, _) => { | ||
external_loglevel_default.a.info("processDecryptMessage", msgParams); | ||
const stripped = Object(external_ethereumjs_util_["stripHexPrefix"])(msgParams.data); | ||
@@ -967,3 +953,2 @@ const buff = Buffer.from(stripped, "hex"); | ||
class EthereumPrivateKeyProvider_EthereumPrivateKeyProvider extends base_provider_["BaseProvider"] { | ||
@@ -1057,3 +1042,3 @@ constructor(_ref) { | ||
async lookupNetwork() { | ||
if (!this.provider) throw external_eth_rpc_errors_["ethErrors"].provider.custom({ | ||
if (!this._providerEngineProxy) throw external_eth_rpc_errors_["ethErrors"].provider.custom({ | ||
message: "Provider is not initialized", | ||
@@ -1071,7 +1056,7 @@ code: 4902 | ||
if (parseInt(chainId, 16) !== parseInt(network, 10)) throw external_eth_rpc_errors_["ethErrors"].provider.chainDisconnected("Invalid network, net_version is: ".concat(network)); | ||
external_loglevel_default.a.debug("this provider", this.provider, chainId, this.state.chainId); | ||
if (this.state.chainId !== chainId) { | ||
this.provider.emit("chainChanged", chainId); | ||
this.provider.emit("connect", { | ||
this._providerEngineProxy.emit("chainChanged", chainId); | ||
this._providerEngineProxy.emit("connect", { | ||
chainId | ||
@@ -1078,0 +1063,0 @@ }); |
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import { createFetchMiddleware, providerFromEngine, signMessage } from '@toruslabs/base-controllers'; | ||
import { createScaffoldMiddleware, createAsyncMiddleware, mergeMiddleware, JRPCEngine } from '@toruslabs/openlogin-jrpc'; | ||
import { CHAIN_NAMESPACES, WalletLoginError, isHexStrict, WalletInitializationError } from '@web3auth/base'; | ||
import { CHAIN_NAMESPACES, WalletLoginError, isHexStrict, WalletInitializationError, log } from '@web3auth/base'; | ||
import { BaseProvider } from '@web3auth/base-provider'; | ||
import { ethErrors } from 'eth-rpc-errors'; | ||
import log from 'loglevel'; | ||
import Common, { Hardfork } from '@ethereumjs/common'; | ||
@@ -278,2 +277,3 @@ import { TransactionFactory } from '@ethereumjs/tx'; | ||
processTransaction, | ||
processSignTransaction, | ||
processEthSignMessage, | ||
@@ -294,2 +294,3 @@ processTypedMessage, | ||
processEthSignMessage, | ||
processSignTransaction, | ||
processTypedMessage, | ||
@@ -423,3 +424,2 @@ processTypedMessageV3, | ||
processTypedMessage: async (msgParams, _) => { | ||
log.debug("processTypedMessage", msgParams); | ||
const result = await connector.signTypedData([msgParams.from, msgParams.data]); | ||
@@ -612,4 +612,4 @@ return result; | ||
name, | ||
chainId: chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
chainId: !chainId || chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: !chainId || chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
hardfork | ||
@@ -667,3 +667,2 @@ }; | ||
processTypedMessage: async (msgParams, _) => { | ||
log.debug("processTypedMessage", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -678,3 +677,2 @@ const sig = signTypedData({ | ||
processTypedMessageV3: async (msgParams, _) => { | ||
log.debug("processTypedMessageV3", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -689,3 +687,2 @@ const sig = signTypedData({ | ||
processTypedMessageV4: async (msgParams, _) => { | ||
log.debug("processTypedMessageV4", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -704,3 +701,2 @@ const sig = signTypedData({ | ||
processDecryptMessage: (msgParams, _) => { | ||
log.info("processDecryptMessage", msgParams); | ||
const stripped = stripHexPrefix(msgParams.data); | ||
@@ -808,3 +804,3 @@ const buff = Buffer.from(stripped, "hex"); | ||
async lookupNetwork() { | ||
if (!this.provider) throw ethErrors.provider.custom({ | ||
if (!this._providerEngineProxy) throw ethErrors.provider.custom({ | ||
message: "Provider is not initialized", | ||
@@ -822,7 +818,7 @@ code: 4902 | ||
if (parseInt(chainId, 16) !== parseInt(network, 10)) throw ethErrors.provider.chainDisconnected("Invalid network, net_version is: ".concat(network)); | ||
log.debug("this provider", this.provider, chainId, this.state.chainId); | ||
if (this.state.chainId !== chainId) { | ||
this.provider.emit("chainChanged", chainId); | ||
this.provider.emit("connect", { | ||
this._providerEngineProxy.emit("chainChanged", chainId); | ||
this._providerEngineProxy.emit("connect", { | ||
chainId | ||
@@ -829,0 +825,0 @@ }); |
{ | ||
"name": "@web3auth/ethereum-provider", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/Web3Auth/Web3Auth#readme", | ||
@@ -25,10 +25,9 @@ "license": "ISC", | ||
"@metamask/eth-sig-util": "^4.0.0", | ||
"@toruslabs/base-controllers": "^1.6.3", | ||
"@toruslabs/base-controllers": "^1.6.5", | ||
"@toruslabs/openlogin-jrpc": "^1.5.0", | ||
"@walletconnect/types": "~1.7.1", | ||
"@web3auth/base": "^0.3.1", | ||
"@web3auth/base-provider": "^0.3.1", | ||
"@walletconnect/types": "~1.7.4", | ||
"@web3auth/base": "^0.4.0", | ||
"@web3auth/base-provider": "^0.4.0", | ||
"eth-rpc-errors": "^4.0.3", | ||
"ethereumjs-util": "^7.1.4", | ||
"loglevel": "^1.8.0" | ||
"ethereumjs-util": "^7.1.4" | ||
}, | ||
@@ -38,3 +37,3 @@ "devDependencies": { | ||
"@types/node": "^16", | ||
"lint-staged": "^12.3.4" | ||
"lint-staged": "^12.3.5" | ||
}, | ||
@@ -65,3 +64,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "6b260ab49cf538dc24fc72829d6c429f56ebd7aa" | ||
"gitHead": "7d8c4d062a44d0b2ae0beaa9ccfb77c5395fbbf3" | ||
} |
@@ -5,3 +5,2 @@ import { MessageTypes, TypedDataV1, TypedMessage } from "@metamask/eth-sig-util"; | ||
import { ethErrors } from "eth-rpc-errors"; | ||
import log from "loglevel"; | ||
@@ -40,3 +39,2 @@ import { IProviderHandlers } from "../../rpc/ethRpcMiddlewares"; | ||
processTypedMessage: async (msgParams: MessageParams<TypedDataV1>, _: JRPCRequest<unknown>): Promise<string> => { | ||
log.debug("processTypedMessage", msgParams); | ||
const result = await connector.signTypedData([msgParams.from, msgParams.data]); | ||
@@ -43,0 +41,0 @@ return result; |
@@ -6,3 +6,2 @@ import { providerFromEngine } from "@toruslabs/base-controllers"; | ||
import { ethErrors } from "eth-rpc-errors"; | ||
import log from "loglevel"; | ||
@@ -91,3 +90,3 @@ import { | ||
protected async lookupNetwork(): Promise<string> { | ||
if (!this.provider) throw ethErrors.provider.custom({ message: "Provider is not initialized", code: 4902 }); | ||
if (!this._providerEngineProxy) throw ethErrors.provider.custom({ message: "Provider is not initialized", code: 4902 }); | ||
const { chainId } = this.config.chainConfig; | ||
@@ -101,7 +100,5 @@ if (!chainId) throw ethErrors.rpc.invalidParams("chainId is required while lookupNetwork"); | ||
if (parseInt(chainId, 16) !== parseInt(network, 10)) throw ethErrors.provider.chainDisconnected(`Invalid network, net_version is: ${network}`); | ||
log.debug("this provider", this.provider, chainId, this.state.chainId); | ||
if (this.state.chainId !== chainId) { | ||
this.provider.emit("chainChanged", chainId); | ||
this.provider.emit("connect", { chainId }); | ||
this._providerEngineProxy.emit("chainChanged", chainId); | ||
this._providerEngineProxy.emit("connect", { chainId }); | ||
} | ||
@@ -108,0 +105,0 @@ this.update({ chainId }); |
@@ -16,6 +16,5 @@ import Common, { Hardfork } from "@ethereumjs/common"; | ||
import { JRPCRequest } from "@toruslabs/openlogin-jrpc"; | ||
import { CustomChainConfig } from "@web3auth/base"; | ||
import { CustomChainConfig, log } from "@web3auth/base"; | ||
import { ethErrors } from "eth-rpc-errors"; | ||
import { privateToAddress, stripHexPrefix } from "ethereumjs-util"; | ||
import log from "loglevel"; | ||
@@ -31,4 +30,4 @@ import { IProviderHandlers } from "../../rpc/ethRpcMiddlewares"; | ||
name, | ||
chainId: chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
chainId: !chainId || chainId === "loading" ? 0 : parseInt(chainId, 16), | ||
networkId: !chainId || chainId === "loading" ? 0 : Number.parseInt(chainId, 10), | ||
hardfork, | ||
@@ -62,3 +61,3 @@ }; | ||
}); | ||
return txHash; | ||
return txHash as string; | ||
}, | ||
@@ -81,3 +80,2 @@ processSignTransaction: async (txParams: TransactionParams, _: JRPCRequest<unknown>): Promise<string> => { | ||
processTypedMessage: async (msgParams: MessageParams<TypedDataV1>, _: JRPCRequest<unknown>): Promise<string> => { | ||
log.debug("processTypedMessage", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -88,3 +86,2 @@ const sig = signTypedData({ privateKey: privKeyBuffer, data: msgParams.data, version: SignTypedDataVersion.V1 }); | ||
processTypedMessageV3: async (msgParams: TypedMessageParams<TypedMessage<MessageTypes>>, _: JRPCRequest<unknown>): Promise<string> => { | ||
log.debug("processTypedMessageV3", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -95,3 +92,2 @@ const sig = signTypedData({ privateKey: privKeyBuffer, data: msgParams.data, version: SignTypedDataVersion.V3 }); | ||
processTypedMessageV4: async (msgParams: TypedMessageParams<TypedMessage<MessageTypes>>, _: JRPCRequest<unknown>): Promise<string> => { | ||
log.debug("processTypedMessageV4", msgParams); | ||
const privKeyBuffer = Buffer.from(privKey, "hex"); | ||
@@ -106,3 +102,2 @@ const sig = signTypedData({ privateKey: privKeyBuffer, data: msgParams.data, version: SignTypedDataVersion.V4 }); | ||
processDecryptMessage: (msgParams: MessageParams<string>, _: JRPCRequest<unknown>): string => { | ||
log.info("processDecryptMessage", msgParams); | ||
const stripped = stripHexPrefix(msgParams.data); | ||
@@ -109,0 +104,0 @@ const buff = Buffer.from(stripped, "hex"); |
@@ -19,2 +19,3 @@ import { | ||
processTransaction, | ||
processSignTransaction, | ||
processEthSignMessage, | ||
@@ -37,2 +38,3 @@ processTypedMessage, | ||
processEthSignMessage, | ||
processSignTransaction, | ||
processTypedMessage, | ||
@@ -39,0 +41,0 @@ processTypedMessageV3, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
7146498
11
9474
+ Added@web3auth/base@0.4.0(transitive)
+ Added@web3auth/base-provider@0.4.0(transitive)
- Removedloglevel@^1.8.0
- Removed@web3auth/base@0.3.1(transitive)
- Removed@web3auth/base-provider@0.3.1(transitive)
Updated@walletconnect/types@~1.7.4
Updated@web3auth/base@^0.4.0