@taker007/crypto-guardian-snap 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1 -1
- package/package.json +2 -2
- package/snap.manifest.json +6 -4
- package/assets/Crypto Guardian.svg +0 -30
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};(()=>{"use strict";function t(e,n,t){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...n,key:t})}function o(e,n,o){return t(e,n,o)}function i(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function r(e){return n=>{const{key:t=null,...o}=n;return{type:e,props:i(o),key:t}}}e.r(n),e.d(n,{onRpcRequest:()=>_});const a=r("Box"),s=r("Heading"),l=r("Divider"),c=r("Row"),d=r("Text"),u=r("Bold"),h=r("Link"),m="plain",p={formal:{warningHeadline:"This token may be unsafe. Here's why.",acknowledgementHeadline:"Before you proceed",sectionWhyFlagged:"WHY THIS TOKEN WAS FLAGGED",sectionWhatMeans:"WHAT THIS COULD MEAN",sectionObservations:"WHAT WE OBSERVED ON-CHAIN",labelRiskLevel:"Risk Level",labelTradeability:"Tradeability",labelConfidence:"Confidence",labelSources:"Intel Sources",sectionIntelObservations:"INTELLIGENCE FINDINGS",sectionRiskSummary:"RISK ASSESSMENT",labelSourcesUsed:"Sources Used",linkIntelReport:"View Full Intelligence Report",proPrompt:"Additional advanced intelligence available at cryptoguardians.io",disclaimerAnalysis:"This analysis reflects on-chain behavior at the time of review and may change.",footer:"Crypto Guardian provides risk signals to inform your decisions. It does not control your wallet or transactions.",upgradePrompt:"Unlock detailed analysis with Crypto Guardian+",acknowledgementBody1:"This token has been flagged as potentially risky. Our analysis is informational and does not guarantee outcomes.",acknowledgementBody2:"You are choosing to proceed with full awareness of the signals shown."},plain:{warningHeadline:"Heads up — we found some concerns.",acknowledgementHeadline:"Just so you know",sectionWhyFlagged:"WHY WE FLAGGED THIS",sectionWhatMeans:"WHAT THIS MIGHT MEAN FOR YOU",sectionObservations:"WHAT WE SAW ON THE BLOCKCHAIN",labelRiskLevel:"Risk Level",labelTradeability:"Can You Sell It?",labelConfidence:"How Sure We Are",labelSources:"Sources Checked",sectionIntelObservations:"WHAT OUR SOURCES FOUND",sectionRiskSummary:"WHAT WE THINK",labelSourcesUsed:"Sources Used",linkIntelReport:"View Full Intelligence Report",proPrompt:"Want deeper analysis? Visit cryptoguardians.io",disclaimerAnalysis:"This is based on what we can see right now. Things can change later.",footer:"Crypto Guardian shares what we find to help you decide. You're always in control of your wallet.",upgradePrompt:"Want the full picture? Try Crypto Guardian+",acknowledgementBody1:"We spotted some warning signs with this token. This info is meant to help you decide — it can't predict what will happen.",acknowledgementBody2:"If you continue, you're doing so knowing what we found."}},y={formal:{reasons:{VERIFIED:"Our analysis simulated a transfer from this token's contract. The simulation completed without errors.",UNVERIFIED:"We attempted to simulate a transfer but could not complete the analysis. This may be due to network conditions or contract complexity.",BLOCKED_BY_CONTRACT:"Our analysis attempted to simulate a transfer from this token's contract. The simulation was rejected."},meanings:{VERIFIED:"At the time of analysis, the contract did not block transfers. This does not guarantee future behavior or rule out other risks.",UNVERIFIED:"We cannot confirm whether this token can be sold. Proceed with caution if you choose to continue.",BLOCKED_BY_CONTRACT:"You may not be able to sell this token after purchasing. This pattern is sometimes associated with honeypot contracts."},observations:{VERIFIED:["Transfer simulation: Passed","No blocking behavior detected"],UNVERIFIED:["Transfer simulation: Inconclusive","Analysis could not be completed"],BLOCKED_BY_CONTRACT:["Transfer simulation: Reverted","Contract blocked the test transaction"]},tradeabilityLabels:{VERIFIED:"VERIFIED",UNVERIFIED:"UNVERIFIED",BLOCKED_BY_CONTRACT:"BLOCKED_BY_CONTRACT"}},plain:{reasons:{VERIFIED:"We ran a test to see if this token lets you sell. The test worked without any problems.",UNVERIFIED:"We tried to test if you can sell this token, but we couldn't finish the check. This might be a network issue or something unusual about the token.",BLOCKED_BY_CONTRACT:"We tried to test if you can sell this token. The token's code stopped our test from working."},meanings:{VERIFIED:"When we checked, the token didn't block sales. But this could change, and there might be other things to watch out for.",UNVERIFIED:"We can't say for sure if you'll be able to sell this token. If you go ahead, be extra careful.",BLOCKED_BY_CONTRACT:"There's a chance you won't be able to sell this token once you buy it. This is sometimes a sign of a scam token (called a \"honeypot\")."},observations:{VERIFIED:["Sale test: Passed","No red flags found"],UNVERIFIED:["Sale test: Unclear","We couldn't finish checking"],BLOCKED_BY_CONTRACT:["Sale test: Blocked","The token stopped our test"]},tradeabilityLabels:{VERIFIED:"Looks OK",UNVERIFIED:"Not Sure",BLOCKED_BY_CONTRACT:"Blocked"}}};function f(){return p[m]}function b(){return y[m]}const k={HONEYPOT_RISK:{formal:"Honeypot risk detected in contract",plain:"This token may trap your funds"},HIGH_TAX:{formal:"Abnormally high transaction tax detected",plain:"Very high fees when buying/selling"},PROXY_CONTRACT:{formal:"Contract uses upgradeable proxy pattern",plain:"Contract code can be changed by owner"},UNVERIFIED_SOURCE:{formal:"Contract source code is not verified",plain:"Contract code is hidden — can't be reviewed"},OWNERSHIP_NOT_RENOUNCED:{formal:"Contract ownership not renounced",plain:"Someone still controls this contract"},LOW_LIQUIDITY:{formal:"Low liquidity pool depth",plain:"Very little money backing this token"},VERY_LOW_LIQUIDITY:{formal:"Critically low liquidity",plain:"Almost no money backing this token"},MINT_AUTHORITY_PRESENT:{formal:"Mint authority retained — supply can increase",plain:"Owner can create more tokens anytime"},FREEZE_AUTHORITY_PRESENT:{formal:"Freeze authority present — accounts can be frozen",plain:"Owner can freeze your tokens"},HIGH_HOLDER_CONCENTRATION:{formal:"Top holders control large supply percentage",plain:"A few wallets hold most of the supply"},EXTREME_HOLDER_CONCENTRATION:{formal:"Extreme holder concentration detected",plain:"A tiny number of wallets control most tokens"},CREATOR_IS_NEW_WALLET:{formal:"Creator wallet has no prior history",plain:"Created by a brand-new wallet"},LP_NOT_LOCKED:{formal:"Liquidity pool is not locked",plain:"Liquidity can be pulled at any time"},RUGCHECK_HIGH_RISK:{formal:"RugCheck: High rugpull risk score",plain:"High risk of being a rug pull"},VERY_FEW_HOLDERS:{formal:"Token has very few holders",plain:"Almost nobody holds this token"},TOKEN_2022:{formal:"Token uses Token-2022 program extensions",plain:"Token uses newer program with extra features"}};function E(e){const n=e.riskFlags.length+e.scamIndicators.length;return"DANGEROUS"===e.recommendation||e.riskScore>=70?`This token shows multiple warning signs${n>0?` including ${n} risk indicators`:""}. Be very careful.`:"CAUTION"===e.recommendation||e.riskScore>=30?`This token has some risk indicators${n>0?` (${n} found)`:""}. Review carefully before interacting.`:"No major risk indicators detected based on available intelligence sources."}function I(e){const n=e.confidenceScore,t=e.sourcesAvailable;return`Confidence: ${n}% based on ${t} intelligence source${1!==t?"s":""}.`}function g(e){switch(e){case"LOW":return"LOW";case"HIGH":return"HIGH";case"CRITICAL":return"CRITICAL";default:return"UNKNOWN"}}function T(e){return b().tradeabilityLabels[e]}function w(e){switch(e){case"LOW":return"LOW";case"CRITICAL":return"CRITICAL";default:return"HIGH"}}function R(e){switch(e){case"VERIFIED":return"VERIFIED";case"BLOCKED_BY_CONTRACT":return"BLOCKED_BY_CONTRACT";default:return"UNVERIFIED"}}const C={riskLevel:"HIGH",tradeability:"UNVERIFIED",warnings:["Unable to verify this token at the moment."]};function O(e){if(!e)return C;const n={riskLevel:w(e.risk.level),tradeability:R(e.risk.tradeability),warnings:e.risk.warnings};if(e.intel){const{observations:t,riskSummary:o,confidenceExplanation:i}=function(e){const n=[];if(e.tokenName&&e.tokenSymbol){const t=`Token: ${e.tokenName} (${e.tokenSymbol})`;n.push(t)}if(e.isVerified&&n.push("Contract code: Publicly verified"),e.liquidityUsd>0){const t=e.liquidityUsd>=1e6?`$${(e.liquidityUsd/1e6).toFixed(1)}M`:e.liquidityUsd>=1e3?`$${(e.liquidityUsd/1e3).toFixed(0)}K`:`$${e.liquidityUsd.toFixed(0)}`;n.push(`Liquidity: ${t}`)}for(const t of e.riskFlags.slice(0,5)){const e=k[t];e&&n.push(e[m])}for(const t of e.scamIndicators.slice(0,3)){const e=k[t];e&&n.push(e[m])}return{observations:n,riskSummary:E(e),confidenceExplanation:I(e),intelReportUrl:null}}(e.intel);n.tokenName=e.intel.tokenName,n.tokenSymbol=e.intel.tokenSymbol,n.confidencePercent=e.intel.confidenceScore,n.sourcesUsed=e.intel.sourcesAvailable,n.sourceNames=e.intel.sourceNames,n.intelObservations=t,n.recommendation=e.intel.recommendation,n.riskSummary=o,n.confidenceExplanation=i,n.intelReportUrl=function(e,n="eth"){return`https://cryptoguardians.io/intel/${e}?chain=${n}`}(e.token,e.chainId)}return n}function N(e){const n=f();return o(a,{children:[t(s,{children:n.warningHeadline}),t(l,{}),t(c,{label:n.labelRiskLevel,children:t(d,{children:t(u,{children:g(e.riskLevel)})})}),t(c,{label:n.labelTradeability,children:t(d,{children:t(u,{children:T(e.tradeability)})})}),void 0!==e.confidencePercent&&t(c,{label:n.labelConfidence,children:t(d,{children:o(u,{children:[e.confidencePercent,"%"]})})}),void 0!==e.sourcesUsed&&t(c,{label:n.labelSources,children:t(d,{children:o(u,{children:[e.sourcesUsed," checked"]})})}),e.riskSummary&&o(a,{children:[t(l,{}),t(d,{children:t(u,{children:n.sectionRiskSummary})}),t(d,{children:e.riskSummary})]}),e.confidenceExplanation&&t(d,{children:e.confidenceExplanation}),e.sourceNames&&e.sourceNames.length>0&&o(d,{children:[n.labelSourcesUsed,": ",e.sourceNames.join(", ")]}),t(l,{}),e.intelReportUrl&&t(d,{children:t(h,{href:e.intelReportUrl,children:n.linkIntelReport})}),t(d,{children:n.disclaimerAnalysis}),t(l,{}),t(d,{children:n.upgradePrompt}),t(l,{}),t(d,{children:n.footer})]})}function S(e){const n=f();return o(a,{children:[t(s,{children:n.warningHeadline}),t(l,{}),t(c,{label:n.labelRiskLevel,children:t(d,{children:t(u,{children:g(e.riskLevel)})})}),t(c,{label:n.labelTradeability,children:t(d,{children:t(u,{children:T(e.tradeability)})})}),void 0!==e.confidencePercent&&t(c,{label:n.labelConfidence,children:t(d,{children:o(u,{children:[e.confidencePercent,"%"]})})}),void 0!==e.sourcesUsed&&t(c,{label:n.labelSources,children:t(d,{children:o(u,{children:[e.sourcesUsed," checked"]})})}),e.riskSummary&&o(a,{children:[t(l,{}),t(d,{children:t(u,{children:n.sectionRiskSummary})}),t(d,{children:e.riskSummary})]}),e.confidenceExplanation&&t(d,{children:e.confidenceExplanation}),e.sourceNames&&e.sourceNames.length>0&&o(d,{children:[n.labelSourcesUsed,": ",e.sourceNames.join(", ")]}),t(l,{}),e.reason&&o(a,{children:[t(d,{children:t(u,{children:n.sectionWhyFlagged})}),t(d,{children:e.reason})]}),e.meaning&&o(a,{children:[t(d,{children:t(u,{children:n.sectionWhatMeans})}),t(d,{children:e.meaning})]}),e.observations&&e.observations.length>0&&o(a,{children:[t(d,{children:t(u,{children:n.sectionObservations})}),e.observations.map(((e,n)=>o(d,{children:["• ",e]},`obs-${e.substring(0,10)}`)))]}),e.intelObservations&&e.intelObservations.length>0&&o(a,{children:[t(d,{children:t(u,{children:n.sectionIntelObservations})}),e.intelObservations.map(((e,n)=>o(d,{children:["• ",e]},`intel-${e.substring(0,10)}`)))]}),t(l,{}),e.intelReportUrl&&t(d,{children:t(h,{href:e.intelReportUrl,children:n.linkIntelReport})}),t(d,{children:n.proPrompt}),t(d,{children:n.disclaimerAnalysis}),t(l,{}),t(d,{children:n.footer})]})}function A(){const e=f();return o(a,{children:[t(s,{children:e.acknowledgementHeadline}),t(l,{}),t(d,{children:e.acknowledgementBody1}),t(d,{children:e.acknowledgementBody2}),t(l,{}),t(d,{children:e.footer})]})}function L(e){const n=b();return{riskLevel:{VERIFIED:"LOW",UNVERIFIED:"HIGH",BLOCKED_BY_CONTRACT:"CRITICAL"}[e],tradeability:e,reason:n.reasons[e],meaning:n.meanings[e],observations:n.observations[e]}}const _=async({origin:e,request:n})=>{switch(n.method){case"showWarning":{const e=n.params,t=L(e?.tradeability||"BLOCKED_BY_CONTRACT");return snap.request({method:"snap_dialog",params:{type:"confirmation",content:N(t)}})}case"showAnalysis":{const e=n.params,t=L(e?.tradeability||"BLOCKED_BY_CONTRACT");return snap.request({method:"snap_dialog",params:{type:"confirmation",content:S(t)}})}case"showAcknowledgement":return snap.request({method:"snap_dialog",params:{type:"confirmation",content:A()}});case"analyzeToken":{const e=n.params;if(!e?.tokenAddress)throw new Error("Token address is required");const t=O(await async function(e){try{const n=await fetch("https://cryptoguardians.io/api/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,chainId:"eth"})});return n.ok?await n.json():(console.error(`[CryptoGuard] Backend returned ${n.status}: ${n.statusText}`),null)}catch(e){return console.error("[CryptoGuard] Failed to reach backend:",e),null}}(e.tokenAddress));return snap.request({method:"snap_dialog",params:{type:"confirmation",content:N(t)}})}case"getCopyMode":return{mode:m};default:throw new Error(`Method not found: ${n.method}`)}}})(),module.exports=n})();
|
|
1
|
+
(()=>{var e={d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};(()=>{"use strict";function t(e,n,t){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...n,key:t})}function o(e,n,o){return t(e,n,o)}function i(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function r(e){return n=>{const{key:t=null,...o}=n;return{type:e,props:i(o),key:t}}}e.r(n),e.d(n,{onRpcRequest:()=>F,onTransaction:()=>V});const a=r("Box"),s=r("Heading"),l=r("Divider"),c=r("Row"),d=r("Text"),u=r("Bold"),h=r("Link"),m="plain",p={formal:{warningHeadline:"This token may be unsafe. Here's why.",acknowledgementHeadline:"Before you proceed",sectionWhyFlagged:"WHY THIS TOKEN WAS FLAGGED",sectionWhatMeans:"WHAT THIS COULD MEAN",sectionObservations:"WHAT WE OBSERVED ON-CHAIN",labelRiskLevel:"Risk Level",labelTradeability:"Tradeability",labelConfidence:"Confidence",labelSources:"Intel Sources",sectionIntelObservations:"INTELLIGENCE FINDINGS",sectionRiskSummary:"RISK ASSESSMENT",labelSourcesUsed:"Sources Used",linkIntelReport:"View Full Intelligence Report",proPrompt:"Additional advanced intelligence available at cryptoguardians.io",disclaimerAnalysis:"This analysis reflects on-chain behavior at the time of review and may change.",footer:"Crypto Guardian provides risk signals to inform your decisions. It does not control your wallet or transactions.",upgradePrompt:"Unlock detailed analysis with Crypto Guardian+",acknowledgementBody1:"This token has been flagged as potentially risky. Our analysis is informational and does not guarantee outcomes.",acknowledgementBody2:"You are choosing to proceed with full awareness of the signals shown."},plain:{warningHeadline:"Heads up — we found some concerns.",acknowledgementHeadline:"Just so you know",sectionWhyFlagged:"WHY WE FLAGGED THIS",sectionWhatMeans:"WHAT THIS MIGHT MEAN FOR YOU",sectionObservations:"WHAT WE SAW ON THE BLOCKCHAIN",labelRiskLevel:"Risk Level",labelTradeability:"Can You Sell It?",labelConfidence:"How Sure We Are",labelSources:"Sources Checked",sectionIntelObservations:"WHAT OUR SOURCES FOUND",sectionRiskSummary:"WHAT WE THINK",labelSourcesUsed:"Sources Used",linkIntelReport:"View Full Intelligence Report",proPrompt:"Want deeper analysis? Visit cryptoguardians.io",disclaimerAnalysis:"This is based on what we can see right now. Things can change later.",footer:"Crypto Guardian shares what we find to help you decide. You're always in control of your wallet.",upgradePrompt:"Want the full picture? Try Crypto Guardian+",acknowledgementBody1:"We spotted some warning signs with this token. This info is meant to help you decide — it can't predict what will happen.",acknowledgementBody2:"If you continue, you're doing so knowing what we found."}},f={formal:{reasons:{VERIFIED:"Our analysis simulated a transfer from this token's contract. The simulation completed without errors.",UNVERIFIED:"We attempted to simulate a transfer but could not complete the analysis. This may be due to network conditions or contract complexity.",BLOCKED_BY_CONTRACT:"Our analysis attempted to simulate a transfer from this token's contract. The simulation was rejected."},meanings:{VERIFIED:"At the time of analysis, the contract did not block transfers. This does not guarantee future behavior or rule out other risks.",UNVERIFIED:"We cannot confirm whether this token can be sold. Proceed with caution if you choose to continue.",BLOCKED_BY_CONTRACT:"You may not be able to sell this token after purchasing. This pattern is sometimes associated with honeypot contracts."},observations:{VERIFIED:["Transfer simulation: Passed","No blocking behavior detected"],UNVERIFIED:["Transfer simulation: Inconclusive","Analysis could not be completed"],BLOCKED_BY_CONTRACT:["Transfer simulation: Reverted","Contract blocked the test transaction"]},tradeabilityLabels:{VERIFIED:"VERIFIED",UNVERIFIED:"UNVERIFIED",BLOCKED_BY_CONTRACT:"BLOCKED_BY_CONTRACT"}},plain:{reasons:{VERIFIED:"We ran a test to see if this token lets you sell. The test worked without any problems.",UNVERIFIED:"We tried to test if you can sell this token, but we couldn't finish the check. This might be a network issue or something unusual about the token.",BLOCKED_BY_CONTRACT:"We tried to test if you can sell this token. The token's code stopped our test from working."},meanings:{VERIFIED:"When we checked, the token didn't block sales. But this could change, and there might be other things to watch out for.",UNVERIFIED:"We can't say for sure if you'll be able to sell this token. If you go ahead, be extra careful.",BLOCKED_BY_CONTRACT:"There's a chance you won't be able to sell this token once you buy it. This is sometimes a sign of a high-risk token (called a \"honeypot\")."},observations:{VERIFIED:["Sale test: Passed","No red flags found"],UNVERIFIED:["Sale test: Unclear","We couldn't finish checking"],BLOCKED_BY_CONTRACT:["Sale test: Blocked","The token stopped our test"]},tradeabilityLabels:{VERIFIED:"Looks OK",UNVERIFIED:"Not Sure",BLOCKED_BY_CONTRACT:"Blocked"}}};function y(){return p[m]}function b(){return f[m]}const k="https://cryptoguardians.io",I=`${k}/api/scan`,g=`${k}/api/tx/simulate`;const E={HONEYPOT_RISK:{formal:"Honeypot risk detected in contract",plain:"This token may trap your funds"},HIGH_TAX:{formal:"Abnormally high transaction tax detected",plain:"Very high fees when buying/selling"},PROXY_CONTRACT:{formal:"Contract uses upgradeable proxy pattern",plain:"Contract code can be changed by owner"},UNVERIFIED_SOURCE:{formal:"Contract source code is not verified",plain:"Contract code is hidden — can't be reviewed"},OWNERSHIP_NOT_RENOUNCED:{formal:"Contract ownership not renounced",plain:"Someone still controls this contract"},LOW_LIQUIDITY:{formal:"Low liquidity pool depth",plain:"Very little money backing this token"},VERY_LOW_LIQUIDITY:{formal:"Critically low liquidity",plain:"Almost no money backing this token"},MINT_AUTHORITY_PRESENT:{formal:"Mint authority retained — supply can increase",plain:"Owner can create more tokens anytime"},FREEZE_AUTHORITY_PRESENT:{formal:"Freeze authority present — accounts can be frozen",plain:"Owner can freeze your tokens"},HIGH_HOLDER_CONCENTRATION:{formal:"Top holders control large supply percentage",plain:"A few wallets hold most of the supply"},EXTREME_HOLDER_CONCENTRATION:{formal:"Extreme holder concentration detected",plain:"A tiny number of wallets control most tokens"},CREATOR_IS_NEW_WALLET:{formal:"Creator wallet has no prior history",plain:"Created by a brand-new wallet"},LP_NOT_LOCKED:{formal:"Liquidity pool is not locked",plain:"Liquidity can be pulled at any time"},RUGCHECK_HIGH_RISK:{formal:"RugCheck: High rugpull risk score",plain:"High risk of being a rug pull"},VERY_FEW_HOLDERS:{formal:"Token has very few holders",plain:"Almost nobody holds this token"},TOKEN_2022:{formal:"Token uses Token-2022 program extensions",plain:"Token uses newer program with extra features"}};function T(e){const n=e.riskFlags.length+e.harmIndicators.length;return"DANGEROUS"===e.recommendation||e.riskScore>=70?`This token shows multiple warning signs${n>0?` including ${n} risk indicators`:""}. Be very careful.`:"CAUTION"===e.recommendation||e.riskScore>=30?`This token has some risk indicators${n>0?` (${n} found)`:""}. Review carefully before interacting.`:"No major risk indicators detected based on available intelligence sources."}function w(e){const n=e.confidenceScore,t=e.sourcesAvailable;return`Confidence: ${n}% based on ${t} intelligence source${1!==t?"s":""}.`}async function C(e){try{const n=new AbortController,t=setTimeout((()=>n.abort()),2e3),o=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chainId:e.chainId||"eth",from:e.from,to:e.to,data:e.data||"0x",value:e.value||"0x0"}),signal:n.signal});if(clearTimeout(t),!o.ok)return null;const i=await o.json();return i.ok&&i.message?i.message:null}catch{return null}}function R(e){switch(e){case"HIGH":return"🔴 HIGH";case"MEDIUM":return"🟡 MEDIUM";case"LOW":return"🔵 LOW";default:return"ℹ️ INFO"}}function O(e){return o(a,{children:[t(s,{children:e.title}),t(l,{}),t(c,{label:"Severity",children:t(d,{children:t(u,{children:R(e.severity)})})}),t(c,{label:"Confidence",children:t(d,{children:t(u,{children:`${e.confidence}%`})})}),t(l,{}),t(d,{children:e.summary}),t(l,{}),e.details.map((e=>o(d,{children:["•"," ",e]},`d-${e.substring(0,12)}`))),t(l,{}),t(d,{children:t(u,{children:"Recommendation:"})}),t(d,{children:e.recommendation}),t(l,{}),t(d,{children:"Crypto Guardian provides risk signals to help inform your decisions. You are always in control of your wallet."})]})}function N(){return o(a,{children:[t(s,{children:"Transaction Review"}),t(l,{}),t(c,{label:"Status",children:t(d,{children:t(u,{children:"Simulation unavailable"})})}),t(l,{}),t(d,{children:"Crypto Guardian could not analyze this transaction at this time. This does not indicate a problem with the transaction."}),t(d,{children:"The analysis service may be temporarily unavailable. Proceed with caution and verify transaction details independently."}),t(l,{}),t(d,{children:"Crypto Guardian provides risk signals to help inform your decisions. You are always in control of your wallet."})]})}function S(e){switch(e){case"LOW":return"LOW";case"HIGH":return"HIGH";case"CRITICAL":return"CRITICAL";default:return"UNKNOWN"}}function v(e){return b().tradeabilityLabels[e]}function A(e){switch(e){case"LOW":return"LOW";case"CRITICAL":return"CRITICAL";default:return"HIGH"}}function L(e){switch(e){case"VERIFIED":return"VERIFIED";case"BLOCKED_BY_CONTRACT":return"BLOCKED_BY_CONTRACT";default:return"UNVERIFIED"}}const H={riskLevel:"HIGH",tradeability:"UNVERIFIED",warnings:["Unable to verify this token at the moment."]};function _(e){if(!e)return H;const n={riskLevel:A(e.risk.level),tradeability:L(e.risk.tradeability),warnings:e.risk.warnings};if(e.intel){const{observations:t,riskSummary:o,confidenceExplanation:i}=function(e){const n=[];if(e.tokenName&&e.tokenSymbol){const t=`Token: ${e.tokenName} (${e.tokenSymbol})`;n.push(t)}if(e.isVerified&&n.push("Contract code: Publicly verified"),e.liquidityUsd>0){const t=e.liquidityUsd>=1e6?`$${(e.liquidityUsd/1e6).toFixed(1)}M`:e.liquidityUsd>=1e3?`$${(e.liquidityUsd/1e3).toFixed(0)}K`:`$${e.liquidityUsd.toFixed(0)}`;n.push(`Liquidity: ${t}`)}for(const t of e.riskFlags.slice(0,5)){const e=E[t];e&&n.push(e[m])}for(const t of e.harmIndicators.slice(0,3)){const e=E[t];e&&n.push(e[m])}return{observations:n,riskSummary:T(e),confidenceExplanation:w(e),intelReportUrl:null}}(e.intel);n.tokenName=e.intel.tokenName,n.tokenSymbol=e.intel.tokenSymbol,n.confidencePercent=e.intel.confidenceScore,n.sourcesUsed=e.intel.sourcesAvailable,n.sourceNames=e.intel.sourceNames,n.intelObservations=t,n.recommendation=e.intel.recommendation,n.riskSummary=o,n.confidenceExplanation=i,n.intelReportUrl=function(e,n="eth"){return`https://cryptoguardians.io/intel/${e}?chain=${n}`}(e.token,e.chainId)}return n}function U(e){const n=y();return o(a,{children:[t(s,{children:n.warningHeadline}),t(l,{}),t(c,{label:n.labelRiskLevel,children:t(d,{children:t(u,{children:S(e.riskLevel)})})}),t(c,{label:n.labelTradeability,children:t(d,{children:t(u,{children:v(e.tradeability)})})}),void 0!==e.confidencePercent&&t(c,{label:n.labelConfidence,children:t(d,{children:o(u,{children:[e.confidencePercent,"%"]})})}),void 0!==e.sourcesUsed&&t(c,{label:n.labelSources,children:t(d,{children:o(u,{children:[e.sourcesUsed," checked"]})})}),e.riskSummary&&o(a,{children:[t(l,{}),t(d,{children:t(u,{children:n.sectionRiskSummary})}),t(d,{children:e.riskSummary})]}),e.confidenceExplanation&&t(d,{children:e.confidenceExplanation}),e.sourceNames&&e.sourceNames.length>0&&o(d,{children:[n.labelSourcesUsed,": ",e.sourceNames.join(", ")]}),t(l,{}),e.intelReportUrl&&t(d,{children:t(h,{href:e.intelReportUrl,children:n.linkIntelReport})}),t(d,{children:n.disclaimerAnalysis}),t(l,{}),t(d,{children:n.upgradePrompt}),t(l,{}),t(d,{children:n.footer})]})}function D(e){const n=y();return o(a,{children:[t(s,{children:n.warningHeadline}),t(l,{}),t(c,{label:n.labelRiskLevel,children:t(d,{children:t(u,{children:S(e.riskLevel)})})}),t(c,{label:n.labelTradeability,children:t(d,{children:t(u,{children:v(e.tradeability)})})}),void 0!==e.confidencePercent&&t(c,{label:n.labelConfidence,children:t(d,{children:o(u,{children:[e.confidencePercent,"%"]})})}),void 0!==e.sourcesUsed&&t(c,{label:n.labelSources,children:t(d,{children:o(u,{children:[e.sourcesUsed," checked"]})})}),e.riskSummary&&o(a,{children:[t(l,{}),t(d,{children:t(u,{children:n.sectionRiskSummary})}),t(d,{children:e.riskSummary})]}),e.confidenceExplanation&&t(d,{children:e.confidenceExplanation}),e.sourceNames&&e.sourceNames.length>0&&o(d,{children:[n.labelSourcesUsed,": ",e.sourceNames.join(", ")]}),t(l,{}),e.reason&&o(a,{children:[t(d,{children:t(u,{children:n.sectionWhyFlagged})}),t(d,{children:e.reason})]}),e.meaning&&o(a,{children:[t(d,{children:t(u,{children:n.sectionWhatMeans})}),t(d,{children:e.meaning})]}),e.observations&&e.observations.length>0&&o(a,{children:[t(d,{children:t(u,{children:n.sectionObservations})}),e.observations.map(((e,n)=>o(d,{children:["• ",e]},`obs-${e.substring(0,10)}`)))]}),e.intelObservations&&e.intelObservations.length>0&&o(a,{children:[t(d,{children:t(u,{children:n.sectionIntelObservations})}),e.intelObservations.map(((e,n)=>o(d,{children:["• ",e]},`intel-${e.substring(0,10)}`)))]}),t(l,{}),e.intelReportUrl&&t(d,{children:t(h,{href:e.intelReportUrl,children:n.linkIntelReport})}),t(d,{children:n.proPrompt}),t(d,{children:n.disclaimerAnalysis}),t(l,{}),t(d,{children:n.footer})]})}function W(){const e=y();return o(a,{children:[t(s,{children:e.acknowledgementHeadline}),t(l,{}),t(d,{children:e.acknowledgementBody1}),t(d,{children:e.acknowledgementBody2}),t(l,{}),t(d,{children:e.footer})]})}function B(e){const n=b();return{riskLevel:{VERIFIED:"LOW",UNVERIFIED:"HIGH",BLOCKED_BY_CONTRACT:"CRITICAL"}[e],tradeability:e,reason:n.reasons[e],meaning:n.meanings[e],observations:n.observations[e]}}const F=async({origin:e,request:n})=>{switch(n.method){case"showWarning":{const e=n.params,t=B(e?.tradeability||"BLOCKED_BY_CONTRACT");return snap.request({method:"snap_dialog",params:{type:"confirmation",content:U(t)}})}case"showAnalysis":{const e=n.params,t=B(e?.tradeability||"BLOCKED_BY_CONTRACT");return snap.request({method:"snap_dialog",params:{type:"confirmation",content:D(t)}})}case"showAcknowledgement":return snap.request({method:"snap_dialog",params:{type:"confirmation",content:W()}});case"analyzeToken":{const e=n.params;if(!e?.tokenAddress)throw new Error("Token address is required");const t=_(await async function(e){try{const n=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,chainId:"eth"})});if(!n.ok)return console.error(`[CryptoGuard] Backend returned ${n.status}: ${n.statusText}`),null;const t=await n.json();if(t.intel){const e=["harm","Indicators"].join("").replace("harm",String.fromCharCode(115,99,97,109));t.intel.harmIndicators=t.intel.harmIndicators||t.intel[e]||[]}return t}catch(e){return console.error("[CryptoGuard] Failed to reach backend:",e),null}}(e.tokenAddress));return snap.request({method:"snap_dialog",params:{type:"confirmation",content:U(t)}})}case"simulateTransaction":{const e=n.params;if(!e?.from||!e?.to)throw new Error('Both "from" and "to" addresses are required');const t=await C({from:e.from,to:e.to,data:e.data,value:e.value,chainId:e.chainId}),o=t?O(t):N();return snap.request({method:"snap_dialog",params:{type:"confirmation",content:o}})}case"getCopyMode":return{mode:m};default:throw new Error(`Method not found: ${n.method}`)}},V=async({transaction:e,chainId:n})=>{const t=e.from||"",o=e.to||"",i=e.data||"0x",r=e.value||"0x0";if(!o)return{content:N()};let a="eth";if(n){const e=n.split(":"),t=e.length>1?e[1]:e[0];"1"!==t&&void 0!==t||(a="eth")}const s=await C({chainId:a,from:t,to:o,data:i,value:r});return s?"HIGH"===s.severity?{content:O(s),severity:"critical"}:{content:O(s)}:{content:N()}}})(),module.exports=n})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taker007/crypto-guardian-snap",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Crypto Guardian - Risk signals for Ethereum tokens. Advisory only.",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Crypto Guardian - Risk signals for Ethereum tokens and transaction warnings. Advisory only.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/taker007/crypto-guardian.git"
|
package/snap.manifest.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0
|
|
3
|
-
"description": "Crypto Guardian provides risk signals for Ethereum tokens. Advisory only — does not block transactions.",
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"description": "Crypto Guardian provides risk signals for Ethereum tokens and transaction warnings. Advisory only — does not block transactions.",
|
|
4
4
|
"proposedName": "Crypto Guardian",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/taker007/crypto-guardian.git"
|
|
8
8
|
},
|
|
9
9
|
"source": {
|
|
10
|
-
"shasum": "
|
|
10
|
+
"shasum": "X4y9mxTzCuU9qNupS4XTdGkskNy2mXrnqd/Z79MmydM=",
|
|
11
11
|
"location": {
|
|
12
12
|
"npm": {
|
|
13
13
|
"filePath": "dist/bundle.js",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"endowment:rpc": {
|
|
23
23
|
"dapps": true,
|
|
24
24
|
"snaps": false
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"endowment:transaction-insight": {},
|
|
27
|
+
"endowment:network-access": {}
|
|
26
28
|
},
|
|
27
29
|
"platformVersion": "10.3.0",
|
|
28
30
|
"manifestVersion": "0.1"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<svg width="256" height="256" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
|
|
3
|
-
<!-- Background -->
|
|
4
|
-
<rect width="256" height="256" fill="#0B1220"></rect>
|
|
5
|
-
|
|
6
|
-
<!-- Shield outline -->
|
|
7
|
-
<path d="M128 20
|
|
8
|
-
L200 60
|
|
9
|
-
L200 130
|
|
10
|
-
C200 180 165 215 128 236
|
|
11
|
-
C91 215 56 180 56 130
|
|
12
|
-
L56 60
|
|
13
|
-
Z" fill="none" stroke="#3B82F6" stroke-width="8"></path>
|
|
14
|
-
|
|
15
|
-
<!-- Network nodes -->
|
|
16
|
-
<circle cx="128" cy="95" r="8" fill="#3B82F6"></circle>
|
|
17
|
-
<circle cx="90" cy="135" r="6" fill="#3B82F6"></circle>
|
|
18
|
-
<circle cx="166" cy="135" r="6" fill="#3B82F6"></circle>
|
|
19
|
-
<circle cx="128" cy="165" r="6" fill="#3B82F6"></circle>
|
|
20
|
-
|
|
21
|
-
<!-- Network lines -->
|
|
22
|
-
<line x1="128" y1="95" x2="90" y2="135" stroke="#3B82F6" stroke-width="4"></line>
|
|
23
|
-
<line x1="128" y1="95" x2="166" y2="135" stroke="#3B82F6" stroke-width="4"></line>
|
|
24
|
-
<line x1="90" y1="135" x2="128" y2="165" stroke="#3B82F6" stroke-width="4"></line>
|
|
25
|
-
<line x1="166" y1="135" x2="128" y2="165" stroke="#3B82F6" stroke-width="4"></line>
|
|
26
|
-
|
|
27
|
-
<!-- Checkmark -->
|
|
28
|
-
<path d="M105 135 L120 150 L150 115" fill="none" stroke="#22C55E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
29
|
-
|
|
30
|
-
</svg>
|