SafePal is the preferred wallet: listed first with a Recommended tag in the picker, detected by flag/window.safepal, named first in the in-app notice, join error, chatbot answer and AI prompt
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+13
-4
@@ -30,15 +30,23 @@
|
||||
if(eth&&Array.isArray(eth.providers)){
|
||||
eth.providers.forEach(function(p){
|
||||
if(!p)return;
|
||||
var nm=p.isPhantom?'Phantom':p.isMetaMask?'MetaMask':p.isCoinbaseWallet?'Coinbase Wallet':p.isTrust||p.isTrustWallet?'Trust Wallet':p.isRabby?'Rabby':'Injected wallet';
|
||||
var nm=p.isSafePal?'SafePal':p.isPhantom?'Phantom':p.isMetaMask?'MetaMask':p.isCoinbaseWallet?'Coinbase Wallet':p.isTrust||p.isTrustWallet?'Trust Wallet':p.isRabby?'Rabby':'Injected wallet';
|
||||
add(p,nm);
|
||||
});
|
||||
}
|
||||
// SafePal (the wallet we recommend): its extension and app browser inject window.safepal / window.safepalProvider,
|
||||
// and flag window.ethereum.isSafePal when they hold the slot
|
||||
if(window.safepalProvider) add(window.safepalProvider,'SafePal','com.safepal');
|
||||
if(window.safepal&&window.safepal.ethereum) add(window.safepal.ethereum,'SafePal','com.safepal');
|
||||
if(eth&ð.isSafePal) add(eth,'SafePal','com.safepal');
|
||||
if(window.phantom&&window.phantom.ethereum) add(window.phantom.ethereum,'Phantom','app.phantom');
|
||||
if(eth&ð.isPhantom&&!(window.phantom&&window.phantom.ethereum)) add(eth,'Phantom','app.phantom');
|
||||
}catch(e){}
|
||||
return list;
|
||||
}
|
||||
// SafePal is the wallet the team recommends: it sits first in the picker and carries the tag (Marty, 2026-09-20)
|
||||
function isSafePal(w){ var n=String((w.info&&w.info.name)||'').toLowerCase(), r=String((w.info&&w.info.rdns)||'').toLowerCase(); return n.indexOf('safepal')>=0||r.indexOf('safepal')>=0||!!(w.provider&&w.provider.isSafePal); }
|
||||
function preferred(list){ return list.slice().sort(function(a,b){ return (isSafePal(b)?1:0)-(isSafePal(a)?1:0); }); }
|
||||
|
||||
function showPicker(list){
|
||||
return new Promise(function(resolve){
|
||||
@@ -47,12 +55,13 @@
|
||||
var box=document.createElement('div');
|
||||
box.style.cssText='background:#0b1e30;border:1px solid #27445e;border-radius:16px;padding:20px;max-width:360px;width:100%;box-shadow:0 20px 60px rgba(0,0,0,.55)';
|
||||
var h=document.createElement('div'); h.style.cssText='font-weight:800;font-size:17px;color:#f7f9fc;margin-bottom:4px'; h.textContent='Choose your wallet'; box.appendChild(h);
|
||||
var s=document.createElement('div'); s.style.cssText='color:#aebdca;font-size:13px;margin-bottom:14px'; s.textContent='Pick the wallet you want to connect with.'; box.appendChild(s);
|
||||
list.forEach(function(w){
|
||||
var s=document.createElement('div'); s.style.cssText='color:#aebdca;font-size:13px;margin-bottom:14px'; s.textContent='SafePal is the wallet we recommend. Any of these works.'; box.appendChild(s);
|
||||
preferred(list).forEach(function(w){
|
||||
var b=document.createElement('button');
|
||||
b.style.cssText='display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:#132c43;border:1px solid #294a65;border-radius:11px;padding:12px 14px;margin-bottom:8px;cursor:pointer;color:#f7f9fc;font-weight:700;font-size:15px';
|
||||
if(w.info.icon){ var img=document.createElement('img'); img.src=w.info.icon; img.alt=''; img.style.cssText='width:26px;height:26px;border-radius:6px;flex:none'; b.appendChild(img); }
|
||||
var sp=document.createElement('span'); sp.textContent=w.info.name||'Wallet'; b.appendChild(sp);
|
||||
if(isSafePal(w)){ var tag=document.createElement('span'); tag.textContent='Recommended'; tag.style.cssText='margin-left:auto;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#0b1e30;background:#f3be43;border-radius:999px;padding:3px 8px;flex:none'; b.appendChild(tag); }
|
||||
b.addEventListener('click',function(){ try{document.body.removeChild(ov);}catch(e){} resolve(w.provider); });
|
||||
box.appendChild(b);
|
||||
});
|
||||
@@ -77,7 +86,7 @@
|
||||
}, 220);
|
||||
});
|
||||
},
|
||||
list:function(){ return probeInjected(found.slice()); },
|
||||
list:function(){ return preferred(probeInjected(found.slice())); },
|
||||
// Switch the wallet to Polygon (137) so a SIWE sign-in whose message says
|
||||
// "Chain ID: 137" matches the wallet's active chain — otherwise wallets
|
||||
// refuse the signature with a "chain ID does not match" error. Adds Polygon
|
||||
|
||||
Reference in New Issue
Block a user