UNPKG

@mojito-inc/secondary-market

Version:

Mojito secondary market is the platform to purchase NFT.

2 lines (1 loc) 741 B
import{ethers as e,utils as s}from"ethers";import t from"../constant/contractABI/BalanceWETH.js";import{ErrorsType as r}from"../constant/index.js";async function a({price:a,currencyContractAddress:n,provider:o}){var i,c;try{const r=t.abi,i=o.getSigner(),c=new e.Contract(n,r,i),u=await c.deposit({value:s.parseEther(String(a))});return await o.waitForTransaction(u.hash,1),{status:!0,message:""}}catch(e){return(null===(i=e.message)||void 0===i?void 0:i.includes(r.USER_REJECTED))||(null===(c=e.message)||void 0===c?void 0:c.includes(r.USER_DENIED))?{status:!1,message:"Transaction has been cancelled by user"}:{status:!1,message:(null==e?void 0:e.message)||"An error was encountered while processing your payment"}}}export{a as swapPrice};