feat: injected request function

change version to 0.1.3
This commit is contained in:
Pasha8914 2021-06-02 23:36:38 +10:00 committed by 0xZick 地方分権化
parent 170d58e067
commit 8d7c3f9e34
2 changed files with 6 additions and 2 deletions

View File

@ -197,9 +197,13 @@ export default (ctx, inject) => {
async _initProvider() { async _initProvider() {
try { try {
const request = () => let request = () =>
this.version === 'old' ? this.provider.enable() : this.sendRequest({ method: 'eth_requestAccounts' }) this.version === 'old' ? this.provider.enable() : this.sendRequest({ method: 'eth_requestAccounts' })
if (this.provider.injectedRequest && typeof this.provider.injectedRequest === 'function') {
request = () => this.provider.injectedRequest()
}
const [account] = await request() const [account] = await request()
if (!account) { if (!account) {

View File

@ -1,6 +1,6 @@
{ {
"name": "nuxt-web3-provider", "name": "nuxt-web3-provider",
"version": "0.1.2", "version": "0.1.3",
"description": "Provider integration with Nuxt.js", "description": "Provider integration with Nuxt.js",
"repository": { "repository": {
"type": "git", "type": "git",