fix: check version

This commit is contained in:
Nik Dement'ev 2020-11-18 10:25:03 +03:00
parent cf186e3f2b
commit 11ff298672
No known key found for this signature in database
GPG Key ID: 769B05D57CF16FE2
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ const Web3 = require('web3')
const { hexToNumberString, toChecksumAddress, numberToHex } = require('web3-utils') const { hexToNumberString, toChecksumAddress, numberToHex } = require('web3-utils')
export default (ctx, inject) => { export default (ctx, inject) => {
const moduleOptions = <%= JSON.stringify(options) %> // const moduleOptions = <%= JSON.stringify(options) %>
const instance = class Provider { const instance = class Provider {
constructor(options) { constructor(options) {
@ -16,7 +16,7 @@ export default (ctx, inject) => {
async initProvider(provider) { async initProvider(provider) {
try { try {
this.provider = provider this.provider = provider
this.web3 = new Web3(provider) // this.web3 = new Web3(provider)
await this._checkVersion() await this._checkVersion()
return await this._initProvider() return await this._initProvider()
@ -180,7 +180,7 @@ export default (ctx, inject) => {
async _initProvider() { async _initProvider() {
try { try {
const request = () => const request = () =>
this.version ? this.provider.enable() : this.sendRequest({ method: 'eth_requestAccounts' }) this.version === 'old' ? this.provider.enable() : this.sendRequest({ method: 'eth_requestAccounts' })
const [account] = await request('') const [account] = await request('')

View File

@ -1,6 +1,6 @@
{ {
"name": "@nuxtjs/provider", "name": "@nuxtjs/provider",
"version": "0.0.5", "version": "0.0.6",
"description": "Provider integration with Nuxt.js", "description": "Provider integration with Nuxt.js",
"repository": "provider-module", "repository": "provider-module",
"license": "MIT", "license": "MIT",