UNPKG

@multiversx/sdk-dapp-swap

Version:

A library to hold the main logic for swapping between tokens on the MultiversX blockchain

3 lines (2 loc) 674 B
import{f as s}from"./chunk-DKQLHRWP.js";s();import{useEffect as w,useState as e}from"react";var q=({activeRoute:o})=>{let[n,c]=e("normal"),[a,I]=e(),[i,k]=e(),[d,g]=e(),[u,m]=e(),[R,T]=e(),[l,v]=e(),[h,x]=e(),[D,O]=e(),p=()=>{if(!o)return;let{tokenInID:t,tokenOutID:r,tokenInExchangeRateDenom:U,tokenInPriceUSD:E,tokenOutExchangeRateDenom:f,tokenOutPriceUSD:S}=o;k(r),m(t),I(f),g(S),v(t),O(r),T(U),x(E)},P=()=>{c(t=>t==="normal"?"reverse":"normal")};return w(p,[o,n]),{tokenInId:n==="normal"?i:l,tokenInIdPriceUsd:n==="normal"?d:h,tokenOutId:n==="normal"?u:D,exchangeRate:n==="normal"?a:R,switchTokensDirection:P}};export{q as a}; //# sourceMappingURL=chunk-OZLDW2QC.js.map