mirror of
https://github.com/andrei0x309/clear-wallet.git
synced 2024-11-18 23:41:10 +00:00
chore: changes for 1.4.4
This commit is contained in:
parent
a6bc10c49b
commit
fb384f2db5
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Manifest Version 1.4.4
|
||||||
|
|
||||||
|
- added QR scaner for easier sign in with farcaster
|
||||||
|
- added cyber network in the network templates
|
||||||
|
- style changes and changes to fracaster action screen
|
||||||
|
|
||||||
## Manifest Version 1.4.3
|
## Manifest Version 1.4.3
|
||||||
|
|
||||||
- changed sign in with farcaster to work with new type of QR code
|
- changed sign in with farcaster to work with new type of QR code
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"@ionic/vue-router": "^8.2.6",
|
"@ionic/vue-router": "^8.2.6",
|
||||||
"core-js": "^3.38.0",
|
"core-js": "^3.38.0",
|
||||||
"ethers": "^6.13.2",
|
"ethers": "^6.13.2",
|
||||||
|
"qr-scanner": "^1.4.2",
|
||||||
"vue": "^3.4.37",
|
"vue": "^3.4.37",
|
||||||
"vue-router": "^4.4.3"
|
"vue-router": "^4.4.3"
|
||||||
},
|
},
|
||||||
|
26
src/utils/QR.ts
Normal file
26
src/utils/QR.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import QrScanner from 'qr-scanner';
|
||||||
|
|
||||||
|
function base64ImageToBlob(str: string) {
|
||||||
|
const pos = str.indexOf(";base64,");
|
||||||
|
const type = str.substring(5, pos);
|
||||||
|
const b64 = str.substr(pos + 8);
|
||||||
|
const imageContent = atob(b64);
|
||||||
|
const buffer = new ArrayBuffer(imageContent.length);
|
||||||
|
const view = new Uint8Array(buffer);
|
||||||
|
for(var n = 0; n < imageContent.length; n++) {
|
||||||
|
view[n] = imageContent.charCodeAt(n);
|
||||||
|
}
|
||||||
|
const blob = new Blob([buffer], { type: type });
|
||||||
|
return blob;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getQRCode(imageBase64: string) {
|
||||||
|
try {
|
||||||
|
const imageBlob = base64ImageToBlob(imageBase64);
|
||||||
|
|
||||||
|
return await QrScanner.scanImage(imageBlob)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -3,20 +3,21 @@ import { FARCASTER_PARTIAL_KEY_ABI } from './abis'
|
|||||||
import { ethers } from 'ethers'
|
import { ethers } from 'ethers'
|
||||||
import { getUrl } from './platform'
|
import { getUrl } from './platform'
|
||||||
import { generateApiToken } from './warpcast-auth'
|
import { generateApiToken } from './warpcast-auth'
|
||||||
|
import { getQRCode } from './QR'
|
||||||
export interface TChannelTokenStatusResponse {
|
export interface TChannelTokenStatusResponse {
|
||||||
state: string;
|
state: string;
|
||||||
nonce: string;
|
nonce: string;
|
||||||
signatureParams: {
|
signatureParams: {
|
||||||
siweUri: string;
|
siweUri: string;
|
||||||
domain: string;
|
domain: string;
|
||||||
nonce: string;
|
nonce: string;
|
||||||
notBefore: string;
|
notBefore: string;
|
||||||
expirationTime: string;
|
expirationTime: string;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
metadata: {
|
metadata: {
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
ip: string;
|
ip: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +26,17 @@ const WARPCAST_BASE = 'https://client.warpcast.com/v2/'
|
|||||||
const EP_SIGNIN = `${WARPCAST_BASE}sign-in-with-farcaster`
|
const EP_SIGNIN = `${WARPCAST_BASE}sign-in-with-farcaster`
|
||||||
const FC_ID_REGISTRY_CONTRACT = '0x00000000fc6c5f01fc30151999387bb99a9f489b'
|
const FC_ID_REGISTRY_CONTRACT = '0x00000000fc6c5f01fc30151999387bb99a9f489b'
|
||||||
|
|
||||||
|
export const getLinkFromQR = async () => {
|
||||||
|
const data = await chrome.tabs.captureVisibleTab()
|
||||||
|
return await getQRCode(data)
|
||||||
|
}
|
||||||
|
|
||||||
const getChannelTokenStatus = async (channelToken: string) => {
|
const getChannelTokenStatus = async (channelToken: string) => {
|
||||||
const response = await fetch(`${TOKEN_STATUS_ENDPOINT}`, {
|
const response = await fetch(`${TOKEN_STATUS_ENDPOINT}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${channelToken}`
|
'Authorization': `Bearer ${channelToken}`
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return response.json() as Promise<TChannelTokenStatusResponse>
|
return response.json() as Promise<TChannelTokenStatusResponse>
|
||||||
@ -65,23 +70,23 @@ export const extractLinkData = (link: string) => {
|
|||||||
|
|
||||||
export const extractResponseData = async (channelToken: string) => {
|
export const extractResponseData = async (channelToken: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await getChannelTokenStatus(channelToken);
|
const response = await getChannelTokenStatus(channelToken);
|
||||||
let { siweUri, domain, nonce, notBefore, expirationTime } = response.signatureParams;
|
let { siweUri, domain, nonce, notBefore, expirationTime } = response.signatureParams;
|
||||||
nonce = nonce || (Math.random() + 1).toString(36).substring(7);
|
nonce = nonce || (Math.random() + 1).toString(36).substring(7);
|
||||||
return {
|
return {
|
||||||
siweUri,
|
siweUri,
|
||||||
domain,
|
domain,
|
||||||
nonce,
|
nonce,
|
||||||
notBefore,
|
notBefore,
|
||||||
expirationTime
|
expirationTime
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validateLinkData = (link: string) => {
|
export const validateLinkData = (link: string) => {
|
||||||
const { channelToken} = extractLinkData(link);
|
const { channelToken } = extractLinkData(link);
|
||||||
if (!channelToken) {
|
if (!channelToken) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -106,7 +111,7 @@ export const constructWarpcastSWIEMsg = ({
|
|||||||
fid: number,
|
fid: number,
|
||||||
custodyAddress: string
|
custodyAddress: string
|
||||||
}) => {
|
}) => {
|
||||||
return `${domain} wants you to sign in with your Ethereum account:\n${custodyAddress}\n\nFarcaster Auth\n\nURI: ${siweUri}\nVersion: 1\nChain ID: 10\nNonce: ${nonce}${notBefore ? `\nIssued At: ${notBefore}`: `\nIssued At: ${new Date(Date.now() - 1000).toISOString()}`}${expirationTime ? `\nExpiration Time: ${expirationTime}` : ''}${notBefore ? `\nNot Before: ${notBefore}`: ''}\nResources:\n- farcaster://fid/${fid}`
|
return `${domain} wants you to sign in with your Ethereum account:\n${custodyAddress}\n\nFarcaster Auth\n\nURI: ${siweUri}\nVersion: 1\nChain ID: 10\nNonce: ${nonce}${notBefore ? `\nIssued At: ${notBefore}` : `\nIssued At: ${new Date(Date.now() - 1000).toISOString()}`}${expirationTime ? `\nExpiration Time: ${expirationTime}` : ''}${notBefore ? `\nNot Before: ${notBefore}` : ''}\nResources:\n- farcaster://fid/${fid}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +120,7 @@ export const signInWithFarcaster = async ({
|
|||||||
message,
|
message,
|
||||||
signature,
|
signature,
|
||||||
authToken
|
authToken
|
||||||
} : {
|
}: {
|
||||||
channelToken: string,
|
channelToken: string,
|
||||||
message: string,
|
message: string,
|
||||||
signature: string,
|
signature: string,
|
||||||
@ -125,7 +130,7 @@ export const signInWithFarcaster = async ({
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${authToken}`
|
'Authorization': `Bearer ${authToken}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
channelToken,
|
channelToken,
|
||||||
@ -148,9 +153,9 @@ const noFidNotification = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getFidFromAddress = async (address: string) : Promise<number | null> => {
|
export const getFidFromAddress = async (address: string): Promise<number | null> => {
|
||||||
const provider = await getOptimismProvider();
|
const provider = await getOptimismProvider();
|
||||||
const contract = new ethers.Contract(FC_ID_REGISTRY_CONTRACT, FARCASTER_PARTIAL_KEY_ABI, provider);
|
const contract = new ethers.Contract(FC_ID_REGISTRY_CONTRACT, FARCASTER_PARTIAL_KEY_ABI, provider);
|
||||||
const FID = await contract.idOf(address);
|
const FID = await contract.idOf(address);
|
||||||
if (FID > 0) {
|
if (FID > 0) {
|
||||||
return FID;
|
return FID;
|
||||||
@ -159,6 +164,66 @@ export const getFidFromAddress = async (address: string) : Promise<number | null
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const doSignInWithFarcasterQR = async () => {
|
||||||
|
const custodyAddress = (await getSelectedAddress())?.[0] || '';
|
||||||
|
const fid = custodyAddress && await getFidFromAddress(custodyAddress);
|
||||||
|
if (!fid) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const link = await getLinkFromQR();
|
||||||
|
if (!link) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateLinkDataResult = validateLinkData(link);
|
||||||
|
if (!validateLinkDataResult) {
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { channelToken } = extractLinkData(link);
|
||||||
|
|
||||||
|
const extractResult = await extractResponseData(channelToken);
|
||||||
|
|
||||||
|
if (!extractResult) {
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { siweUri, domain, nonce, notBefore, expirationTime } = extractResult
|
||||||
|
|
||||||
|
const message = constructWarpcastSWIEMsg({
|
||||||
|
siweUri,
|
||||||
|
domain,
|
||||||
|
nonce,
|
||||||
|
notBefore,
|
||||||
|
expirationTime,
|
||||||
|
fid,
|
||||||
|
custodyAddress
|
||||||
|
});
|
||||||
|
|
||||||
|
const genToken = await generateApiToken();
|
||||||
|
|
||||||
|
let authToken = '';
|
||||||
|
if (genToken.success) {
|
||||||
|
authToken = genToken.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!authToken) {
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
|
||||||
|
const signature = await signMsg(message);
|
||||||
|
await signInWithFarcaster({
|
||||||
|
channelToken,
|
||||||
|
message,
|
||||||
|
signature,
|
||||||
|
authToken
|
||||||
|
});
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export const doSignInWithFarcaster = async ({
|
export const doSignInWithFarcaster = async ({
|
||||||
link
|
link
|
||||||
}: {
|
}: {
|
||||||
@ -166,7 +231,7 @@ export const doSignInWithFarcaster = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { channelToken } = extractLinkData(link);
|
const { channelToken } = extractLinkData(link);
|
||||||
const custodyAddress = (await getSelectedAddress())?.[0] || '';
|
const custodyAddress = (await getSelectedAddress())?.[0] || '';
|
||||||
const fid = custodyAddress && await getFidFromAddress(custodyAddress);
|
const fid = custodyAddress && await getFidFromAddress(custodyAddress);
|
||||||
if (!fid) {
|
if (!fid) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -191,7 +256,7 @@ export const doSignInWithFarcaster = async ({
|
|||||||
|
|
||||||
const genToken = await generateApiToken();
|
const genToken = await generateApiToken();
|
||||||
let authToken = '';
|
let authToken = '';
|
||||||
if(genToken.success) {
|
if (genToken.success) {
|
||||||
authToken = genToken.data;
|
authToken = genToken.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,4 +274,3 @@ export const doSignInWithFarcaster = async ({
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
||||||
>These are experimental features RE from Warpcast might not work in all cases
|
>These are experimental features might not work in all cases and might break
|
||||||
and might break if WC makes changes.</ion-label
|
when warpcast/farcaster make changes.</ion-label
|
||||||
>
|
>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<div
|
<div
|
||||||
@ -45,21 +45,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
||||||
>Used for sign in with farcaster/warpcast QR you'll need to paste the deep link
|
>Used for sign in with farcaster/warpcast QR, by scanning QR on pasteing
|
||||||
in next screen</ion-label
|
link.</ion-label
|
||||||
></ion-item
|
></ion-item
|
||||||
>
|
>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-button
|
<button @click="swiwModal = true" class="buttonFc">Sign in with farcaster</button>
|
||||||
@click="swiwModal = true"
|
|
||||||
color="light"
|
|
||||||
style="
|
|
||||||
margin: auto;
|
|
||||||
transform: scale(1.2);
|
|
||||||
filter: hue-rotate(59deg) saturate(1.5) sepia(0.1);
|
|
||||||
"
|
|
||||||
>Sign in with farcaster</ion-button
|
|
||||||
>
|
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
<ion-label style="opacity: 0.9; font-size: 0.85rem"
|
||||||
@ -67,16 +58,7 @@
|
|||||||
>
|
>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-button
|
<button @click="promptForSignIn" class="buttonFc">Login on Warpcast.com</button>
|
||||||
@click="promptForSignIn"
|
|
||||||
style="
|
|
||||||
margin: auto;
|
|
||||||
transform: scale(1.2);
|
|
||||||
filter: hue-rotate(59deg) saturate(1.5) sepia(0.1);
|
|
||||||
"
|
|
||||||
color="light"
|
|
||||||
>Login on Warpcast.com</ion-button
|
|
||||||
>
|
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-alert
|
<ion-alert
|
||||||
@ -141,30 +123,50 @@
|
|||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-button @click="swiwModal = false">Close</ion-button>
|
<ion-button @click="swiwModal = false">Close</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Paste Link To Authorize</ion-title>
|
<ion-title>Authorize</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content class="ion-padding">
|
<ion-content class="ion-padding">
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label
|
<ion-label
|
||||||
>Enter deep-link from Sign in with farcaster QR EX:
|
><h2>Try to scan QR</h2>
|
||||||
<span style="font-size: 0.8rem; opacity: 0.8">
|
<p style="font-size: 0.8rem">
|
||||||
https://warpcast.com/~/sign-in-with-farcaster?channelToken=4a8d3f27-....
|
(must be visible on current page)
|
||||||
</span></ion-label
|
</p></ion-label
|
||||||
>
|
>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-button @click="swiwModal = false" color="light">Cancel</ion-button>
|
||||||
|
<ion-button @click="farcasterSWIWQRAuthorize">Authorize using QR</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label
|
||||||
|
><h2>Alternative: paste link from QR</h2>
|
||||||
|
<p style="font-size: 0.8rem; opacity: 0.9">
|
||||||
|
similar to: https://warpcast.com/~/siwf?channelToken=AXLUD4S4
|
||||||
|
</p></ion-label
|
||||||
|
>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>
|
||||||
|
<p>Account needs to own a fid</p>
|
||||||
|
<p>QR needs to be visible on the website you click authorize</p>
|
||||||
|
</ion-label>
|
||||||
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-textarea
|
<ion-textarea
|
||||||
style="overflow-y: scroll; width: 100%"
|
style="overflow-y: scroll; width: 100%"
|
||||||
aria-label="Enter deep link from Sign in with farcaste QR"
|
aria-label="Enter deep link from Sign in with farcaste QR"
|
||||||
:rows="10"
|
:rows="4"
|
||||||
:cols="10"
|
:cols="8"
|
||||||
v-model="deepLink"
|
v-model="deepLink"
|
||||||
></ion-textarea>
|
></ion-textarea>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-button @click="swiwModal = false" color="light">Cancel</ion-button>
|
<ion-button @click="swiwModal = false" color="light">Cancel</ion-button>
|
||||||
<ion-button @click="farcasterSWIWAithorize">Authorize</ion-button>
|
<ion-button @click="farcasterSWIWAuthorize">Authorize using link</ion-button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
@ -224,6 +226,7 @@ import {
|
|||||||
doSignInWithFarcaster,
|
doSignInWithFarcaster,
|
||||||
validateLinkData,
|
validateLinkData,
|
||||||
getFidFromAddress,
|
getFidFromAddress,
|
||||||
|
doSignInWithFarcasterQR,
|
||||||
} from "@/utils/farcaster";
|
} from "@/utils/farcaster";
|
||||||
import { getAccounts, getSelectedAccount, unBlockLockout } from "@/utils/platform";
|
import { getAccounts, getSelectedAccount, unBlockLockout } from "@/utils/platform";
|
||||||
import { addWarpAuthToken, generateApiToken } from "@/utils/warpcast-auth";
|
import { addWarpAuthToken, generateApiToken } from "@/utils/warpcast-auth";
|
||||||
@ -300,7 +303,7 @@ export default defineComponent({
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const farcasterSWIWAithorize = async () => {
|
const farcasterSWIWAuthorize = async () => {
|
||||||
exitWallet.value = false;
|
exitWallet.value = false;
|
||||||
if (!deepLink.value) {
|
if (!deepLink.value) {
|
||||||
alertMsg.value = "Please enter the deep link";
|
alertMsg.value = "Please enter the deep link";
|
||||||
@ -309,7 +312,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
const linkData = validateLinkData(deepLink.value);
|
const linkData = validateLinkData(deepLink.value);
|
||||||
if (!linkData) {
|
if (!linkData) {
|
||||||
alertMsg.value = "Invalid deep link";
|
alertMsg.value = "Invalid link pasted it does not contain a valid channel token";
|
||||||
alertOpen.value = true;
|
alertOpen.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -331,7 +334,54 @@ export default defineComponent({
|
|||||||
link: deepLink.value,
|
link: deepLink.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("result", result);
|
if (result === -1) {
|
||||||
|
alertMsg.value =
|
||||||
|
"Selected account does not own a FID please select an account that owns a FID";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
return;
|
||||||
|
} else if (result === -2) {
|
||||||
|
alertMsg.value = "Auth token generation failed";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
return;
|
||||||
|
} else if (result === -3) {
|
||||||
|
alertMsg.value =
|
||||||
|
"Error could read chanel token from data, make sure you have copied the correct link";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
alertHeader.value = "OK";
|
||||||
|
alertMsg.value =
|
||||||
|
"Request sent successfully, if QR is still open, you will be signed in";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
exitWallet.value = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alertMsg.value = String(e);
|
||||||
|
alertOpen.value = true;
|
||||||
|
}
|
||||||
|
swloading.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const farcasterSWIWQRAuthorize = async () => {
|
||||||
|
exitWallet.value = false;
|
||||||
|
if ((selectedAccount.value.pk ?? "").length !== 66) {
|
||||||
|
const modalResult = await openModal();
|
||||||
|
if (modalResult) {
|
||||||
|
unBlockLockout();
|
||||||
|
loading.value = true;
|
||||||
|
} else {
|
||||||
|
onCancel();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unBlockLockout();
|
||||||
|
}
|
||||||
|
swloading.value = true;
|
||||||
|
try {
|
||||||
|
const result = await doSignInWithFarcasterQR();
|
||||||
|
|
||||||
if (result === -1) {
|
if (result === -1) {
|
||||||
alertMsg.value =
|
alertMsg.value =
|
||||||
@ -340,20 +390,31 @@ export default defineComponent({
|
|||||||
swloading.value = false;
|
swloading.value = false;
|
||||||
return;
|
return;
|
||||||
} else if (result === -2) {
|
} else if (result === -2) {
|
||||||
alertMsg.value = "Optimism RCP is not available";
|
alertMsg.value =
|
||||||
|
"Failed to read QR data, be sure QR is visible on, if is not working try using link";
|
||||||
alertOpen.value = true;
|
alertOpen.value = true;
|
||||||
swloading.value = false;
|
swloading.value = false;
|
||||||
return;
|
return;
|
||||||
} else if (result === -3) {
|
} else if (result === -3) {
|
||||||
alertMsg.value =
|
alertMsg.value =
|
||||||
"Error could not get signer params from farcaster relay, try again";
|
"QR does not contain a valid channel token, make sure you are scanning a sign in with farcaster QR";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
return;
|
||||||
|
} else if (result === -4) {
|
||||||
|
alertMsg.value = "Failed to extract sign params from QR";
|
||||||
|
alertOpen.value = true;
|
||||||
|
swloading.value = false;
|
||||||
|
return;
|
||||||
|
} else if (result === -5) {
|
||||||
|
alertMsg.value = "Auth token generation failed";
|
||||||
alertOpen.value = true;
|
alertOpen.value = true;
|
||||||
swloading.value = false;
|
swloading.value = false;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
alertHeader.value = "OK";
|
alertHeader.value = "OK";
|
||||||
alertMsg.value =
|
alertMsg.value =
|
||||||
"Request sent successfully, if QR is still open, you should be signed in";
|
"Request sent successfully, if QR is still open, you will be signed in";
|
||||||
alertOpen.value = true;
|
alertOpen.value = true;
|
||||||
swloading.value = false;
|
swloading.value = false;
|
||||||
exitWallet.value = true;
|
exitWallet.value = true;
|
||||||
@ -481,14 +542,113 @@ export default defineComponent({
|
|||||||
toastState,
|
toastState,
|
||||||
deepLink,
|
deepLink,
|
||||||
swiwModal,
|
swiwModal,
|
||||||
farcasterSWIWAithorize,
|
farcasterSWIWAuthorize,
|
||||||
swloading,
|
swloading,
|
||||||
promptForSignIn,
|
promptForSignIn,
|
||||||
warpcastLoading,
|
warpcastLoading,
|
||||||
window,
|
window,
|
||||||
exitWallet,
|
exitWallet,
|
||||||
alertHeader,
|
alertHeader,
|
||||||
|
farcasterSWIWQRAuthorize,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.buttonFc {
|
||||||
|
position: relative;
|
||||||
|
padding: 10px 22px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #7d2ae8;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-top: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonFc:active {
|
||||||
|
transform: scale(0.96);
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonFc:before,
|
||||||
|
.buttonFc:after {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
width: 150%;
|
||||||
|
left: 50%;
|
||||||
|
height: 100%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
z-index: -1000;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonFc:hover:before {
|
||||||
|
top: -70%;
|
||||||
|
background-image: radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, transparent 20%, #7d2ae8 20%, transparent 30%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, transparent 10%, #7d2ae8 15%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%);
|
||||||
|
background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%,
|
||||||
|
18% 18%;
|
||||||
|
background-position: 50% 120%;
|
||||||
|
animation: greentopBubbles 1.1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes greentopBubbles {
|
||||||
|
0% {
|
||||||
|
background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%,
|
||||||
|
55% 90%, 70% 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%,
|
||||||
|
65% 20%, 90% 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%,
|
||||||
|
65% 10%, 90% 20%;
|
||||||
|
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonFc:hover::after {
|
||||||
|
bottom: -70%;
|
||||||
|
background-image: radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, transparent 10%, #7d2ae8 15%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%),
|
||||||
|
radial-gradient(circle, #7d2ae8 20%, transparent 20%);
|
||||||
|
background-size: 15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 20% 20%, 18% 18%;
|
||||||
|
background-position: 50% 0%;
|
||||||
|
animation: greenbottomBubbles 0.6s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes greenbottomBubbles {
|
||||||
|
0% {
|
||||||
|
background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%;
|
||||||
|
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -1145,6 +1145,11 @@
|
|||||||
resolved "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469"
|
resolved "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469"
|
||||||
integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==
|
integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==
|
||||||
|
|
||||||
|
"@types/offscreencanvas@^2019.6.4":
|
||||||
|
version "2019.7.3"
|
||||||
|
resolved "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz#90267db13f64d6e9ccb5ae3eac92786a7c77a516"
|
||||||
|
integrity sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==
|
||||||
|
|
||||||
"@types/readdir-glob@*":
|
"@types/readdir-glob@*":
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/readdir-glob/-/readdir-glob-1.1.1.tgz#27ac2db283e6aa3d110b14ff9da44fcd1a5c38b1"
|
resolved "https://registry.yarnpkg.com/@types/readdir-glob/-/readdir-glob-1.1.1.tgz#27ac2db283e6aa3d110b14ff9da44fcd1a5c38b1"
|
||||||
@ -4054,6 +4059,13 @@ q@^1.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
||||||
integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==
|
integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==
|
||||||
|
|
||||||
|
qr-scanner@^1.4.2:
|
||||||
|
version "1.4.2"
|
||||||
|
resolved "https://registry.npmjs.org/qr-scanner/-/qr-scanner-1.4.2.tgz#bc4fb88022a8c9be95c49527a1c8fb8724b47dc4"
|
||||||
|
integrity sha512-kV1yQUe2FENvn59tMZW6mOVfpq9mGxGf8l6+EGaXUOd4RBOLg7tRC83OrirM5AtDvZRpdjdlXURsHreAOSPOUw==
|
||||||
|
dependencies:
|
||||||
|
"@types/offscreencanvas" "^2019.6.4"
|
||||||
|
|
||||||
queue-microtask@^1.2.2:
|
queue-microtask@^1.2.2:
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||||
|
Loading…
Reference in New Issue
Block a user