mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
Merge branch 'master' into strategies-v2
This commit is contained in:
commit
ed3966b239
|
@ -142,7 +142,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-if="!active"
|
v-else-if="!active"
|
||||||
@click="activate"
|
@click="activate"
|
||||||
class="hidden md:flex bg-primary-blue-dark hover:bg-primary-blue-hover shadow text-white p-3 rounded h-9 items-center justify-center w-40"
|
class="hidden md:flex bg-primary-blue-dark hover:bg-primary-blue-hover shadow text-white p-3 rounded h-9 items-center justify-center w-40"
|
||||||
>
|
>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="text-[#9FB0C9] font-medium text-xs">
|
<div class="text-[#9FB0C9] font-medium text-xs">
|
||||||
Build on top of
|
Build on top of
|
||||||
<a
|
<a
|
||||||
class="ml-2 font-medium text-sm text-primary-blue-dark hover:text-primary-blue-hover py-1"
|
class="ml-1 font-medium text-primary-blue-dark hover:text-primary-blue-hover py-1"
|
||||||
href="https://instadapp.io/"
|
href="https://instadapp.io/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { computed, onMounted, ref, watch } from "@nuxtjs/composition-api";
|
import { computed, onMounted, ref, watch } from "@nuxtjs/composition-api";
|
||||||
import Web3 from "web3";
|
import Web3 from "web3";
|
||||||
import Web3Modal from "web3modal";
|
import { SafeAppWeb3Modal } from "@gnosis.pm/safe-apps-web3modal";
|
||||||
import { Network } from "./useNetwork";
|
import { Network } from "./useNetwork";
|
||||||
|
|
||||||
let web3Modal: Web3Modal;
|
let web3Modal: SafeAppWeb3Modal;
|
||||||
let web3Provider: any;
|
let web3Provider: any;
|
||||||
|
|
||||||
let providerOptions = {};
|
let providerOptions = {};
|
||||||
|
@ -23,7 +23,7 @@ const chains = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const active = ref(false);
|
const active = ref(false);
|
||||||
const chainId = ref<1|137>();
|
const chainId = ref<1 | 137>();
|
||||||
const networkName = computed<Network>(
|
const networkName = computed<Network>(
|
||||||
() => chains.find(c => c.chainId === chainId.value)?.name || Network.Mainnet
|
() => chains.find(c => c.chainId === chainId.value)?.name || Network.Mainnet
|
||||||
);
|
);
|
||||||
|
@ -40,19 +40,25 @@ export function useWeb3() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
web3Modal = new Web3Modal({
|
web3Modal = new SafeAppWeb3Modal({
|
||||||
disableInjectedProvider: false,
|
|
||||||
cacheProvider: true,
|
cacheProvider: true,
|
||||||
providerOptions
|
providerOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
window.web3Modal = web3Modal;
|
||||||
|
|
||||||
if (web3Modal.cachedProvider) {
|
if (web3Modal.cachedProvider) {
|
||||||
await activate();
|
await activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await web3Modal.isSafeApp()) {
|
||||||
|
await activate();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const activate = async () => {
|
const activate = async () => {
|
||||||
web3Provider = await web3Modal.connect();
|
web3Provider = await web3Modal.requestProvider();
|
||||||
active.value = true;
|
active.value = true;
|
||||||
if (web3Provider.selectedAddress) {
|
if (web3Provider.selectedAddress) {
|
||||||
account.value = web3Provider.selectedAddress;
|
account.value = web3Provider.selectedAddress;
|
||||||
|
@ -126,11 +132,11 @@ export function useWeb3() {
|
||||||
|
|
||||||
const setWeb3 = (newWeb3: Web3) => {
|
const setWeb3 = (newWeb3: Web3) => {
|
||||||
web3.value = newWeb3;
|
web3.value = newWeb3;
|
||||||
}
|
};
|
||||||
|
|
||||||
watch(web3, () => {
|
watch(web3, () => {
|
||||||
window.web3 = web3.value;
|
window.web3 = web3.value;
|
||||||
})
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
account,
|
account,
|
||||||
|
@ -141,6 +147,6 @@ export function useWeb3() {
|
||||||
deactivate,
|
deactivate,
|
||||||
networkName,
|
networkName,
|
||||||
refreshWeb3,
|
refreshWeb3,
|
||||||
setWeb3,
|
setWeb3
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
"generate": "nuxt generate"
|
"generate": "nuxt generate"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@gnosis.pm/safe-apps-sdk": "^4.2.0",
|
||||||
|
"@gnosis.pm/safe-apps-web3modal": "^2.0.0",
|
||||||
"@nuxtjs/axios": "^5.13.6",
|
"@nuxtjs/axios": "^5.13.6",
|
||||||
"@nuxtjs/composition-api": "^0.24.7",
|
"@nuxtjs/composition-api": "^0.24.7",
|
||||||
"@portis/web3": "^4.0.5",
|
"@portis/web3": "^4.0.5",
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "App",
|
"short_name": "Assembly",
|
||||||
|
"name": "Instadapp - Assembly",
|
||||||
|
"description": "The Open Source Dashboard for the Instadapp Protocol",
|
||||||
|
"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": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "\/android-icon-36x36.png",
|
"src": "\/android-icon-36x36.png",
|
||||||
|
|
22
yarn.lock
22
yarn.lock
|
@ -1136,6 +1136,26 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
purgecss "^4.0.3"
|
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":
|
"@json-rpc-tools/types@^1.6.1":
|
||||||
version "1.7.6"
|
version "1.7.6"
|
||||||
resolved "https://registry.yarnpkg.com/@json-rpc-tools/types/-/types-1.7.6.tgz#5abd5fde01364a130c46093b501715bcce5bdc0e"
|
resolved "https://registry.yarnpkg.com/@json-rpc-tools/types/-/types-1.7.6.tgz#5abd5fde01364a130c46093b501715bcce5bdc0e"
|
||||||
|
@ -5236,7 +5256,7 @@ eventemitter3@4.0.7, eventemitter3@^4.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
||||||
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
|
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
|
||||||
|
|
||||||
events@^3.0.0:
|
events@^3.0.0, events@^3.3.0:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
|
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
|
||||||
integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==
|
integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==
|
||||||
|
|
Loading…
Reference in New Issue
Block a user