@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
3 lines (2 loc) • 1 kB
JavaScript
import{i as T}from"./chunk-7QE2X3X4.js";import{a as p,b as c,m as u}from"./chunk-HBP5N4FR.js";u();T();import{useState as O}from"react";var f=["create","localMint","ESDTLocalMint","addQuantity","burn","localBurn","ESDTLocalBurn","wipe","writeLog","signalError"];function h({operations:t,transaction:o,isExpanded:r=!1,listLength:n=25}){let i=t.filter(l=>!f.includes(l.action)&&(l.sender===o.sender||l.receiver===o.sender)),e=i.length>0?i:t,s=e.length>n?e.slice(0,n):e,a=e.length>n?e.slice(n,e.length):[],d=r?i.length>0?"Show in/out operations":"Show fewer operations":"Show all operations",g=s.length!==t.length||a.length>0;return{displayedOperations:r?t:s,toggleButtonText:d,showToggleButton:g}}function S(t){let[o,r]=O(!1),n=()=>{r(a=>!a)},{displayedOperations:i,showToggleButton:e,toggleButtonText:s}=h(c(p({},t),{isExpanded:o}));return{isExpanded:o,displayedOperations:i,showToggleButton:e,toggleButtonText:s,onToggleButtonClick:n}}export{h as a,S as b};
//# sourceMappingURL=chunk-F4DRHLRI.js.map