diff --git a/layer/icons/wallet-new/magic.vue b/layer/icons/wallet-new/magic.vue
new file mode 100644
index 00000000..2785d9c8
--- /dev/null
+++ b/layer/icons/wallet-new/magic.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/layer/icons/wallet/magic.vue b/layer/icons/wallet/magic.vue
new file mode 100644
index 00000000..2785d9c8
--- /dev/null
+++ b/layer/icons/wallet/magic.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/layer/store/wallet.ts b/layer/store/wallet.ts
index 198db54b..d4ae3c0c 100644
--- a/layer/store/wallet.ts
+++ b/layer/store/wallet.ts
@@ -14,6 +14,7 @@ import { StatusType } from '@injectivelabs/utils'
import {
Wallet,
isEthWallet,
+ MagicProvider,
isCosmosWallet,
isCosmosBrowserWallet
} from '@injectivelabs/wallet-ts'
@@ -234,8 +235,13 @@ export const useSharedWalletStore = defineStore('sharedWallet', {
async init() {
const walletStore = useSharedWalletStore()
+ walletStore.walletConnectStatus = WalletConnectStatus.idle
await walletStrategy.setWallet(walletStore.wallet)
+ // if (walletStore.wallet === Wallet.Magic && !walletStore.isUserConnected) {
+ // await walletStore.connectMagic()
+ // }
+
if (walletStore.isAutoSignEnabled) {
walletStore.connectWallet(Wallet.PrivateKey, {
privateKey: walletStore.autoSign?.privateKey as string,
@@ -664,12 +670,17 @@ export const useSharedWalletStore = defineStore('sharedWallet', {
await walletStore.onConnect()
},
- async connectMagic(email: string) {
+ async connectMagic(provider?: MagicProvider, email?: string) {
const walletStore = useSharedWalletStore()
await walletStore.connectWallet(Wallet.Magic)
- const addresses = await getAddresses(email)
+ const addresses = await getAddresses({ email, provider })
+
+ if (!addresses.length) {
+ return
+ }
+
const [address] = addresses
const session = await walletStrategy.getSessionOrConfirm(address)
@@ -677,7 +688,7 @@ export const useSharedWalletStore = defineStore('sharedWallet', {
address,
addresses,
addressConfirmation: await walletStrategy.getSessionOrConfirm(address),
- injectiveAddress: getInjectiveAddress(address),
+ injectiveAddress: address,
session
})
@@ -946,6 +957,8 @@ export const useSharedWalletStore = defineStore('sharedWallet', {
async logout() {
const walletStore = useSharedWalletStore()
+ walletStore.walletConnectStatus = WalletConnectStatus.disconnecting
+
await walletStrategy.disconnect()
walletStore.$patch({
diff --git a/layer/types/enum/index.ts b/layer/types/enum/index.ts
index fdb40b8d..6057ac45 100644
--- a/layer/types/enum/index.ts
+++ b/layer/types/enum/index.ts
@@ -16,7 +16,8 @@ export enum WalletConnectStatus {
idle = 'Idle',
connected = 'Connected',
connecting = 'Connecting',
- disconnected = 'Disconnected'
+ disconnected = 'Disconnected',
+ disconnecting = 'disconnecting'
}
export enum SharedAmplitudeEvent {
diff --git a/layer/utils/constant/setup.ts b/layer/utils/constant/setup.ts
index 7abcd3ae..c888cdd4 100644
--- a/layer/utils/constant/setup.ts
+++ b/layer/utils/constant/setup.ts
@@ -141,9 +141,10 @@ export const GEO_IP_RESTRICTIONS_ENABLED: boolean =
import.meta.env.VITE_GEO_IP_RESTRICTIONS_ENABLED === 'true'
export const CW20_ADAPTER_CONTRACT = getCw20AdapterContractForNetwork(NETWORK)
-export const APP_NAME = env.VITE_NAME
-export const APP_BASE_URL = env.VITE_BASE_URL
-export const WALLET_CONNECT_PROJECT_ID = env.VITE_WALLET_CONNECT_PROJECT_ID
+export const APP_NAME = env.VITE_NAME as string
+export const APP_BASE_URL = env.VITE_BASE_URL as string
+export const WALLET_CONNECT_PROJECT_ID =
+ env.VITE_WALLET_CONNECT_PROJECT_ID as string
if (VPN_CHECKS_ENABLED && !GOOGLE_MAPS_KEY) {
throw new Error('GOOGLE_MAPS_KEY is required when VPN_CHECKS_ENABLED')
diff --git a/layer/wallet/wallet-strategy.ts b/layer/wallet/wallet-strategy.ts
index c5765e39..5c843849 100644
--- a/layer/wallet/wallet-strategy.ts
+++ b/layer/wallet/wallet-strategy.ts
@@ -14,6 +14,11 @@ import {
WALLET_CONNECT_PROJECT_ID
} from './../utils/constant'
+console.log(ENDPOINTS.rpc)
+
+const HUNTER_API = 'pk_live_8D40A7E251F283ED'
+const INJECTIVE_API = 'pk_live_E1CB10CF489E800D'
+
export const walletStrategy = new WalletStrategy({
chainId: CHAIN_ID,
ethereumOptions: {
@@ -22,8 +27,10 @@ export const walletStrategy = new WalletStrategy({
},
options: {
metadata: {
- magicApiKey: 'pk_live_57BA82F0A1C914EA',
- rpcEndpoint: ENDPOINTS.rpc,
+ magic: {
+ rpcEndpoint: ENDPOINTS.rpc as string,
+ apiKey: INJECTIVE_API
+ },
name: APP_NAME,
url: APP_BASE_URL,
projectId: WALLET_CONNECT_PROJECT_ID,
diff --git a/layer/yarn.lock b/layer/yarn.lock
index 1c69b49a..a5d5291d 100644
--- a/layer/yarn.lock
+++ b/layer/yarn.lock
@@ -11289,16 +11289,7 @@ strict-uri-encode@^2.0.0:
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==
-"string-width-cjs@npm:string-width@^4.2.0":
- version "4.2.3"
- resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
- integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
- dependencies:
- emoji-regex "^8.0.0"
- is-fullwidth-code-point "^3.0.0"
- strip-ansi "^6.0.1"
-
-"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
+"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -11339,7 +11330,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11353,13 +11344,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"
-strip-ansi@^6.0.0, strip-ansi@^6.0.1:
- version "6.0.1"
- resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
- integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
- dependencies:
- ansi-regex "^5.0.1"
-
strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@@ -12548,7 +12532,7 @@ wordwrapjs@^4.0.0:
reduce-flatten "^2.0.0"
typical "^5.2.0"
-"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
+"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -12575,15 +12559,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"
-wrap-ansi@^7.0.0:
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
- integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
- dependencies:
- ansi-styles "^4.0.0"
- string-width "^4.1.0"
- strip-ansi "^6.0.0"
-
wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"