UNPKG

@mojito-inc/secondary-market

Version:

Mojito secondary market is the platform to purchase NFT.

2 lines (1 loc) 593 B
const e=async(e,t,s)=>{try{const a=parseInt(String(e),10).toString(16).padStart(6,"");return t?(await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${a}`}]}),{status:!0,message:""}):(s.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${a}`}]}),{status:!0,message:""})}catch(e){return"User rejected the request."===(null==e?void 0:e.message)?{status:!1,message:"Network switch has been cancelled by user"}:{status:!1,message:(null==e?void 0:e.message)||"An error was encountered while processing your payment"}}};export{e as onSwitchNetwork};