UNPKG

@mojito-inc/secondary-market

Version:

Mojito secondary market is the platform to purchase NFT.

2 lines (1 loc) 754 B
"use strict";var e=require("ethers"),r=require("../constant/contractABI/BalanceWETH.js"),s=require("../constant/index.js");exports.swapPrice=async function({price:t,currencyContractAddress:a,provider:n}){var i,c;try{const s=r.default.abi,i=n.getSigner(),c=new e.ethers.Contract(a,s,i),o=await c.deposit({value:e.utils.parseEther(String(t))});return await n.waitForTransaction(o.hash,1),{status:!0,message:""}}catch(e){return(null===(i=e.message)||void 0===i?void 0:i.includes(s.ErrorsType.USER_REJECTED))||(null===(c=e.message)||void 0===c?void 0:c.includes(s.ErrorsType.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"}}};