From aa96c615313187375dc8a26a67adf902463f7973 Mon Sep 17 00:00:00 2001 From: Georges KABBOUCHI Date: Thu, 26 Aug 2021 00:26:04 +0300 Subject: [PATCH] Add Gnosis --- composables/useWeb3.ts | 8 ++-- package.json | 2 + static/manifest.json | 89 ++++++++++++++++++++++++------------------ yarn.lock | 22 ++++++++++- 4 files changed, 77 insertions(+), 44 deletions(-) diff --git a/composables/useWeb3.ts b/composables/useWeb3.ts index 0d09b48..5310219 100644 --- a/composables/useWeb3.ts +++ b/composables/useWeb3.ts @@ -1,9 +1,9 @@ import { computed, onMounted, ref, watch } from "@nuxtjs/composition-api"; import Web3 from "web3"; -import Web3Modal from "web3modal"; +import { SafeAppWeb3Modal } from '@gnosis.pm/safe-apps-web3modal' import { Network } from "./useNetwork"; -let web3Modal: Web3Modal; +let web3Modal: SafeAppWeb3Modal; let web3Provider: any; let providerOptions = {}; @@ -40,7 +40,7 @@ export function useWeb3() { return; } - web3Modal = new Web3Modal({ + web3Modal = new SafeAppWeb3Modal({ disableInjectedProvider: false, cacheProvider: true, providerOptions @@ -52,7 +52,7 @@ export function useWeb3() { }); const activate = async () => { - web3Provider = await web3Modal.connect(); + web3Provider = await web3Modal.requestProvider(); active.value = true; if (web3Provider.selectedAddress) { account.value = web3Provider.selectedAddress; diff --git a/package.json b/package.json index 5dffa14..51d7c05 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,8 @@ "generate": "nuxt generate" }, "dependencies": { + "@gnosis.pm/safe-apps-sdk": "^4.2.0", + "@gnosis.pm/safe-apps-web3modal": "^2.0.0", "@nuxtjs/axios": "^5.13.6", "@nuxtjs/composition-api": "^0.24.7", "@portis/web3": "^4.0.5", diff --git a/static/manifest.json b/static/manifest.json index 013d4a6..dd9aff8 100644 --- a/static/manifest.json +++ b/static/manifest.json @@ -1,41 +1,52 @@ { - "name": "App", - "icons": [ - { - "src": "\/android-icon-36x36.png", - "sizes": "36x36", - "type": "image\/png", - "density": "0.75" - }, - { - "src": "\/android-icon-48x48.png", - "sizes": "48x48", - "type": "image\/png", - "density": "1.0" - }, - { - "src": "\/android-icon-72x72.png", - "sizes": "72x72", - "type": "image\/png", - "density": "1.5" - }, - { - "src": "\/android-icon-96x96.png", - "sizes": "96x96", - "type": "image\/png", - "density": "2.0" - }, - { - "src": "\/android-icon-144x144.png", - "sizes": "144x144", - "type": "image\/png", - "density": "3.0" - }, - { - "src": "\/android-icon-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": "4.0" - } - ] + "short_name": "Assembly", + "name": "Instadapp - Assembly", + "description": "The Most Powerful DeFi Management Platform", + "iconPath": "/android-icon-192x192.png", + "providedBy": { + "name": "InstaDApp Labs LLC", + "url": "https://instadapp.io/" + }, + "start_url": "/", + "display": "minimal-ui", + "theme_color": "#3F75FF", + "background_color": "#ffffff", + "icons": [ + { + "src": "\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 4323a84..93d0124 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1136,6 +1136,26 @@ dependencies: purgecss "^4.0.3" +"@gnosis.pm/safe-apps-provider@0.7.1": + version "0.7.1" + resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-apps-provider/-/safe-apps-provider-0.7.1.tgz#d55ba011cd496322faa346a50c1b6aea64b1da43" + integrity sha512-+y+hQ9Zr1GGrzehqdkhOUTEX1Ixm0jGUGMxbXQbG4C3PJRvQ2UVoqIXa7CJcqg0Gzru2bOM5CzNvv8pxxv23GA== + dependencies: + "@gnosis.pm/safe-apps-sdk" "4.2.0" + events "^3.3.0" + +"@gnosis.pm/safe-apps-sdk@4.2.0", "@gnosis.pm/safe-apps-sdk@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-apps-sdk/-/safe-apps-sdk-4.2.0.tgz#77069de1b4f3db724d1ded1fab39e1feacc7bc05" + integrity sha512-GpaxIbi658+KLtJpTGq6qdpVkbW7OQUKh8i0uhZ04SiAoIAtR9QNbP7V04OvvuqhKjhvCnvh37mJH2RZ2zZHDA== + +"@gnosis.pm/safe-apps-web3modal@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-apps-web3modal/-/safe-apps-web3modal-2.0.0.tgz#4da6ab5d62191d5454d3d8eecbfbb6daf38aa92b" + integrity sha512-c0IUukQTvN7c2YB5JkFCF2Rlerud3Ei2CHUaCDykH+4fiGWc0mscFNnPA0v9VZHpkD6kZdfXG7OjsoPCYNdEGQ== + dependencies: + "@gnosis.pm/safe-apps-provider" "0.7.1" + "@json-rpc-tools/types@^1.6.1": version "1.7.6" resolved "https://registry.yarnpkg.com/@json-rpc-tools/types/-/types-1.7.6.tgz#5abd5fde01364a130c46093b501715bcce5bdc0e" @@ -5226,7 +5246,7 @@ eventemitter3@4.0.7, eventemitter3@^4.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== -events@^3.0.0: +events@^3.0.0, events@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==