mirror of
https://github.com/tornadocash/provider.git
synced 2024-11-22 09:46:52 +01:00
fix: check version
This commit is contained in:
parent
cf186e3f2b
commit
11ff298672
@ -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('')
|
||||||
|
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user