asserting toast is a toast 🫡🫡🫡

This commit is contained in:
0xturboblitz
2024-06-20 16:02:51 -07:00
parent 02d549bfaf
commit c5c93fbb66
7 changed files with 20 additions and 20 deletions

View File

@@ -63,7 +63,7 @@ export const sbtApp: AppType = {
return (
<Pressable onPress={() => {
Clipboard.setString(txHash);
toast?.show('🖨️', {
toast.show('🖨️', {
message: "Tx copied to clipboard",
customData: {
type: "success",
@@ -85,7 +85,7 @@ export const sbtApp: AppType = {
const toast = useNavigationStore.getState().toast;
Clipboard.setString(txHash);
toast?.show('🖨️', {
toast.show('🖨️', {
message: "Tx copied to clipboard",
customData: {
type: "success",
@@ -167,7 +167,7 @@ export const sbtApp: AppType = {
setStep(Steps.PROOF_GENERATED);
} catch (error: any) {
console.error(error);
toast?.show('Error', {
toast.show('Error', {
message: error.message,
customData: {
type: "error",
@@ -196,7 +196,7 @@ export const sbtApp: AppType = {
setStep(Steps.PROOF_SENDING);
toast?.show('🚀', {
toast.show('🚀', {
message: "Transaction sent...",
customData: {
type: "info",
@@ -219,7 +219,7 @@ export const sbtApp: AppType = {
console.log('receipt status:', receipt?.status);
if (receipt?.status === 1) {
toast?.show('🎊', {
toast.show('🎊', {
message: "SBT minted",
customData: {
type: "success",
@@ -229,7 +229,7 @@ export const sbtApp: AppType = {
proofSentText: `SBT minted. Network: Sepolia. Transaction hash: ${txHash}`
});
} else {
toast?.show('Error', {
toast.show('Error', {
message: "SBT mint failed",
customData: {
type: "error",
@@ -253,14 +253,14 @@ export const sbtApp: AppType = {
const match = errorMessage.match(/execution reverted: "([^"]*)"/);
if (match && match[1]) {
console.log('Parsed blockchain error:', match[1]);
toast?.show('Error', {
toast.show('Error', {
message: `Error: ${match[1]}`,
customData: {
type: "error",
},
})
} else {
toast?.show('Error', {
toast.show('Error', {
message: `Error: mint failed`,
customData: {
type: "error",

View File

@@ -79,7 +79,7 @@ const MainScreen: React.FC = () => {
})
setStep(Steps.NEXT_SCREEN);
deleteMrzFields();
toast?.show("Using mock passport data!", { type: "info" })
toast.show("Using mock passport data!", { type: "info" })
}
const decrementStep = () => {

View File

@@ -9,7 +9,7 @@ interface NavigationState {
isZkeyDownloading: IsZkeyDownloading
showWarningModal: ShowWarningModalProps
hideData: boolean
toast: ReturnType<typeof useToastController> | null
toast: ReturnType<typeof useToastController>
selectedTab: string
selectedApp: AppType | null
setToast: (toast: ReturnType<typeof useToastController>) => void;
@@ -30,7 +30,7 @@ const useNavigationStore = create<NavigationState>((set, get) => ({
},
hideData: false,
toast: null,
toast: null as unknown as ReturnType<typeof useToastController>,
selectedTab: "scan",
selectedApp: null,

View File

@@ -112,7 +112,7 @@ const useUserStore = create<UserState>((set, get) => ({
const isAlreadyRegistered = await isCommitmentRegistered(secret, passportData);
if (isAlreadyRegistered) {
console.log("commitment is already registered")
toast?.show('Identity already registered, skipping', {
toast.show('Identity already registered, skipping', {
customData: {
type: "info",
},
@@ -172,7 +172,7 @@ const useUserStore = create<UserState>((set, get) => ({
setStep(Steps.REGISTERED);
} catch (error: any) {
console.error(error);
toast?.show('Error', {
toast.show('Error', {
message: "Error registering your identity, please relaunch the app",
customData: {
type: "error",

View File

@@ -20,7 +20,7 @@ export const startCameraScan = async () => {
})
setStep(Steps.MRZ_SCAN_COMPLETED);
toast?.show("Scan successful", {
toast.show("Scan successful", {
message: 'Nice to meet you!',
customData: {
type: "success",
@@ -45,7 +45,7 @@ export const startCameraScan = async () => {
setStep(Steps.MRZ_SCAN_COMPLETED);
amplitude.track('Camera scan successful');
toast?.show("Scan successful", {
toast.show("Scan successful", {
message: 'Nice to meet you!',
customData: {
type: "success",

View File

@@ -27,7 +27,7 @@ export const scan = async () => {
);
if (!check.success) {
toast?.show("Unvailable", {
toast.show("Unvailable", {
message: check.message,
customData: {
type: "info",
@@ -67,7 +67,7 @@ const scanAndroid = async () => {
console.log('error during scan:', e);
setStep(Steps.MRZ_SCAN_COMPLETED);
amplitude.track('NFC scan unsuccessful', { error: JSON.stringify(e) });
toast?.show('Error', {
toast.show('Error', {
message: e.message,
customData: {
type: "error",
@@ -99,7 +99,7 @@ const scanIOS = async () => {
setStep(Steps.MRZ_SCAN_COMPLETED);
amplitude.track(`NFC scan unsuccessful, error ${e.message}`);
if (!e.message.includes("UserCanceled")) {
toast?.show('Failed to read passport', {
toast.show('Failed to read passport', {
message: e.message,
customData: {
type: "error",
@@ -184,7 +184,7 @@ const handleResponseIOS = async (
console.log('error during parsing:', e);
useNavigationStore.getState().setStep(Steps.MRZ_SCAN_COMPLETED);
amplitude.track('Signature algorithm unsupported (ecdsa not parsed)', { error: JSON.stringify(e) });
toast?.show('Error', {
toast.show('Error', {
message: "Your signature algorithm is not supported at that time. Please try again later.",
customData: {
type: "error",

View File

@@ -183,7 +183,7 @@ export async function fetchZkey(
}
});
amplitude.track('zkey download failed: ' + error.message);
toast?.show('Error', {
toast.show('Error', {
message: `Error: ${error.message}`,
customData: {
type: "error",